-
Notifications
You must be signed in to change notification settings - Fork 289
Using a local mock SQS server
Configure Shoryuken to use a local SQS-compatible server for development and testing without connecting to AWS.
ElasticMQ is a lightweight, open-source, in-memory SQS-compatible server. It is used in Shoryuken's own CI. It supports standard queues, FIFO queues, dead-letter queues, message attributes, batch operations, visibility timeout, and long polling. The softwaremill/elasticmq-native image is ~30MB and starts in milliseconds.
The easiest way to run ElasticMQ is with Docker:
docker run -p 9324:9324 softwaremill/elasticmq-native
Or with Docker Compose:
# docker-compose.yml
services:
elasticmq:
image: softwaremill/elasticmq-native:latest
ports:
- "9324:9324"docker compose up -d
Shoryuken.configure_client do |config|
config.sqs_client = Aws::SQS::Client.new(
region: 'us-east-1',
access_key_id: 'fake',
secret_access_key: 'fake',
endpoint: 'http://localhost:9324'
)
endShoryuken.configure_server do |config|
config.sqs_client = Aws::SQS::Client.new(
region: 'us-east-1',
access_key_id: 'fake',
secret_access_key: 'fake',
endpoint: 'http://localhost:9324'
)
endIf you want to use shoryuken sqs command with a different endpoint you can pass an --endpoint option to the command, example:
shoryuken sqs ls --endpoint=http://localhost:9324if you don't want to pass the --endpoint option to all sqs commands you can set an env var for it in the application SHORYUKEN_SQS_ENDPOINT=http://localhost:9324.
ElasticMQ can be configured with a custom.conf file for pre-created queues, FIFO queues, dead-letter queue redrive policies, and more. See the ElasticMQ documentation for details.