serverless-sqs-local
v1.1.2
Published
Serverless plugin for integrating with ElasticMQ when invoking functions locally
Downloads
4,441
Readme
Serverless SQS Local
A Serverless plugin for using ElasticMQ for local development with SQS.
It allows you to create and remove queues defined in your serverless.yml in a locally running ElasticMQ instance, so that you do not have to rely on AWS SQS while developing.
Usage
- Run ElasticMQ locally. Either directly or using docker. See the ElasticMQ docs for more information.
yarn add -D serverless-sqs-local
/npm install --save-dev serverless-sqs-local
- Add
serverless-sqs-local
to thePlugins
section of yourserverless.yml
- Run
SQS_ENDPOINT=<url_to_elasticmq> sls sqs migrate
to create the queues. - Run
SQS_ENDPOINT=<url_to_elasticmq> sls sqs remove
to remove the queues.
The plugin will output the URLs to the queues. They typically have the form <SQS_ENDPOINT>/queue/queue-name
.
I recommend using this plugin together with serverless-sqs-client to transparently switch between AWS SQS and ElasticMQ depending on if you are running in offline mode or note.
Notes
- This plugin currently does not expose a way to install, start and stop ElasticMQ. My current thinking is that this is something that should be solved outside of
serverless
. If you disagree, open an issue and make your case. I am potentially open to contributions to add support for this. - If you have ideas for how to expose the queue urls to the application, please open an issue and explain your idea.
Contributions
If you want to add a new feature, please first open an issue and discuss it with me. If you open a PR directly, it's possible that it might be rejected and your efforts wasted.