A serverless offline plugin that enables AWS MSK events.
Note
Something not working? Open an issue. Pull requests welcome.
See the ./examples folder for fully built out examples.
Install the plugin:
# NPM or Yarn examples below:
npm install --save-dev serverless-offline-msk
yarn add -D serverless-offline-msk
In your serverless.yml
we'll want to add the plugin after serverless-offline:
plugins:
- serverless-offline
- serverless-offline-msk
custom:
serverless-offline-msk:
allowAutoTopicCreation: true # If we can create topics in kafka automatically
brokers: # list of brokers to use for kafka
- "kafka:19092" # this example here is from a docker compose example in examples
The supported options are the same that are supported by serverless and MSK. See the serverless docs for more information.
functions:
consumerName:
events:
- msk: # list of MSK events.
arn: 'arn:*' # requried! in AWS you would use a real MSK ARN, but this can be anything locally
topic: some_topic_name # required! whatever the topic name is.
batchSize: 1
startingPosition: LATEST
enabled: false # this will turn it off
See LICENSE for more info.