https://github.com/screwdriver-cd/aws-producer-service
Screwdriver AWS Integration Producer Service
https://github.com/screwdriver-cd/aws-producer-service
kafka
Last synced: 4 months ago
JSON representation
Screwdriver AWS Integration Producer Service
- Host: GitHub
- URL: https://github.com/screwdriver-cd/aws-producer-service
- Owner: screwdriver-cd
- License: other
- Created: 2021-09-22T15:45:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-20T00:03:54.000Z (over 1 year ago)
- Last Synced: 2025-09-26T11:51:55.441Z (9 months ago)
- Topics: kafka
- Language: JavaScript
- Homepage: https://cd.screwdriver.cd/pipelines/7971/events
- Size: 39.1 KB
- Stars: 0
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aws-producer-service
Screwdriver AWS Integration Producer Service
[![Version][npm-image]][npm-url] ![Downloads][downloads-image] [![Build Status][status-image]][status-url] [![Open Issues][issues-image]][issues-url] ![License][license-image]
> Producer Service for Screwdriver Kafka Queue
This service acts as a message producer and provides and interface to publish messages to Screwdriver Kafka Instance.
## Table of Contents
- [Installation and Usage](#installation-and-usage)
- [Configuration](#configuration)
- [Methods](#methods)
- [Testing](#testing)
- [Contribute](#contribute)
- [License](#license)
### Installation and Usage
```bash
npm install screwdriver-aws-producer-service
```
## Configuration
The configuration for the package
| Parameter | Type | Default | Description |
| :------------- | :---- | :----------| :-----------|
|enabled| bool | true | Flag for enabling broker config|
|hosts| array | [] | Array of broker endpoints|
|sasl| object | | sasl object|
|sasl.mechanism| string | scram-sha-512 | sasl mechanism|
|sasl.secretId| string | - | AWS secret manager id for sasl secret|
|clientId| string | - | Client id connecting to kafka brokers|
|accessKeyId| string | - | AWS access key id|
|secretAccessKey| string | - | AWS secret key id|
|region| string | - | AWS region|
```
kafka:
# flag for kafka broker
enabled: true
# kafka brokers list
hosts: KAFKA_BROKERS_LIST
# sasl options
sasl:
# sasl mechanism
mechanism: scram-sha-512
# secret id for sasl/scram
secretId: fakesecret
# client id of the producer
clientId: sd-producer
# Amazon access key
accessKeyId: KAFKA_ACCESS_KEY_ID
# Amazon secret access key
secretAccessKey: KAFKA_ACCESS_KEY_SECRET
# AWS region
region: AWS_REGION
```
## Methods
#### Producer Methods
#### `connect`
##### Expected Outcome
Connects as a client instance to the kafka broker based on the specified configuration
##### Expected Return
A Promise that resolves to a Kafka producer object.
#### `sendMessage`
##### Expected Outcome
Sends a message to a kafka topic.
##### Required Parameters
| Parameter | Type | Description |
| :------------- | :---- | :-------------|
| producer | Object | The producer object after calling connect() |
| data | Object | The message data object |
| topic | String | The name of the topic |
| messageId | String | The id of the message
#### Admin Methods
#### `connectAdmin`
##### Expected Outcome
Connects as a client instance to the kafka broker based as an admin with elevated permissions on the specified configuration
##### Expected Return
A Promise that resolves to a Kafka admin object.
#### `createTopic`
##### Expected Outcome
Creates a kafka topic and disconnects the admin connection.
##### Required Parameters
| Parameter | Type | Description |
| :------------- | :---- | :-------------|
| admin | Object | The admin object after calling connectAdmin() |
| topic | String | The name of the topic |
#### `getTopicMetadata`
##### Expected Outcome
Gets kafka metadata for the give kafka topic and disconnects the admin connection.
##### Required Parameters
| Parameter | Type | Description |
| :------------- | :---- | :-------------|
| admin | Object | The admin object after calling connectAdmin() |
| topic | String | The name of the topic |
##### Expected Return
A Promise that resolves to a Kafka topic metadata object.
## Testing
```bash
npm test
```
## Contribute
To start contributing to Screwdriver, have a look at our guidelines, as well as pointers on where to start making changes, in our [contributing guide](http://docs.screwdriver.cd/about/contributing).
## License
Code licensed under the BSD 3-Clause license. See LICENSE file for terms.
[npm-image]: https://img.shields.io/npm/v/screwdriver-aws-producer-service.svg
[npm-url]: https://npmjs.org/package/screwdriver-aws-producer-service
[downloads-image]: https://img.shields.io/npm/dt/aws-producer-service.svg
[license-image]: https://img.shields.io/npm/l/aws-producer-service.svg
[issues-image]: https://img.shields.io/github/issues/screwdriver-cd/screwdriver.svg
[issues-url]: https://github.com/screwdriver-cd/screwdriver/issues
[status-image]: https://cd.screwdriver.cd/pipelines/7971/badge
[status-url]: https://cd.screwdriver.cd/pipelines/7971
[screwdriver job-tools]: https://github.com/screwdriver-cd/job-tools