2.0.0 • Published 1 year ago

screwdriver-aws-producer-service v2.0.0

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
1 year ago

aws-producer-service

Screwdriver AWS Integration Producer Service Version Downloads Build Status Open Issues License

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

npm install screwdriver-aws-producer-service

Configuration

The configuration for the package

ParameterTypeDefaultDescription
enabledbooltrueFlag for enabling broker config
hostsarray[]Array of broker endpoints
saslobjectsasl object
sasl.mechanismstringscram-sha-512sasl mechanism
sasl.secretIdstring-AWS secret manager id for sasl secret
clientIdstring-Client id connecting to kafka brokers
accessKeyIdstring-AWS access key id
secretAccessKeystring-AWS secret key id
regionstring-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
ParameterTypeDescription
producerObjectThe producer object after calling connect()
dataObjectThe message data object
topicStringThe name of the topic
messageIdStringThe 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
ParameterTypeDescription
adminObjectThe admin object after calling connectAdmin()
topicStringThe name of the topic

getTopicMetadata

Expected Outcome

Gets kafka metadata for the give kafka topic and disconnects the admin connection.

Required Parameters
ParameterTypeDescription
adminObjectThe admin object after calling connectAdmin()
topicStringThe name of the topic
Expected Return

A Promise that resolves to a Kafka topic metadata object.

Testing

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.

License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.