-
-
Notifications
You must be signed in to change notification settings - Fork 280
Using a local mock SQS server
It is possible to configure Shoryuken to use a local mock SQS server implementation in place of Amazon's real SQS. This is useful, for example, when doing local development without an Internet connection.
This guide will help you to configure one such mock SQS service implementation, moto
. We'll set up aws-sdk-ruby
and shoryuken
to use moto
instead of the real SQS provided by AWS.
At the time of writing, the most recent version of moto
published on PyPi is 0.4.31. This version does not contain the fixes that make it possible to use the SQS implementation in moto
from the AWS SDK for Ruby. For now, doing local SQS development with moto
requires cloning the moto
repository and installing it ourselves.
git clone git@github.com:spulec/moto.git
cd moto
make init
To run it:
moto_server sqs -p 4576
To use a local SQS server, you must be running aws-sdk
version 2.2.15 or later. If your version of aws-sdk
is older, update it.
bundle update aws-sdk
We'll need to change the :sqs_endpoint
key of Shoryuken's AWS config to point to your local moto
instance. We'll also have to disable MD5 checks from send_message*
calls in the AWS SDK.
Shoryuken.configure_client do |config|
config.sqs_client = Aws::SQS::Client.new(
region: ENV["AWS_REGION"],
access_key_id: ENV["AWS_ACCESS_KEY_ID"],
secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
endpoint: 'http://localhost:4576',
verify_checksums: false
)
end
Shoryuken.configure_server do |config|
config.sqs_client = Aws::SQS::Client.new(
region: ENV["AWS_REGION"],
access_key_id: ENV["AWS_ACCESS_KEY_ID"],
secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
endpoint: 'http://localhost:4576',
verify_checksums: false
)
end