https://github.com/tattdcodemonkey/genstage_sqs_example
Example GenStage producer for AWS Simple Queue Service
https://github.com/tattdcodemonkey/genstage_sqs_example
aws elixir genstage sqs
Last synced: 6 months ago
JSON representation
Example GenStage producer for AWS Simple Queue Service
- Host: GitHub
- URL: https://github.com/tattdcodemonkey/genstage_sqs_example
- Owner: TattdCodeMonkey
- License: mit
- Created: 2017-02-14T02:27:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-08T16:54:22.000Z (over 7 years ago)
- Last Synced: 2025-03-10T06:07:07.855Z (7 months ago)
- Topics: aws, elixir, genstage, sqs
- Language: Elixir
- Homepage: http://www.tattdcodemonkey.com/blog/2017/2/1/sqs-genstage
- Size: 8.79 KB
- Stars: 18
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GenstageSqs
This is a simple example of using AWS Simple Queue Service (SQS) as the source for a `GenStage` producer. This elixir app creates 2 producers and 4 consumers, reads messages from the queue and then deletes them. It is a very simple and generic example used only to test the functionality of the producer.
You can read about this in my blog post [Writing a GenStage producer for AWS SQS](http://www.tattdcodemonkey.com/blog/2017/2/1/sqs-genstage)
## Testing
To run this example you will need to set the AWS keys as env variables in the command line or add them to the `config/config.exs` instead of the system envs. See ExAws docs for options for configuration.
1. Run `AWS_ACCESS_KEY_ID=your_access_key AWS_SECRET_ACCESS_KEY=your_secret_key iex -S mix`
2. Enter `iex(1)> GenstageSqs.create_messages(10)`This will cause the producers to start pulling messages from SQS and sending them to the consumers. You can add more of each (producers & consumers) to process more messages or create less to process less messages.