SXS
SNS/SQS wrapper to make development
(Redis) and test
(Memory) environment transparent.
Install
Add the following code on your Gemfile
and run bundle install
:
gem 'sxs'
Run the following task to create a SXS migration:
rails g sxs:install
Usage
SXS::Publisher.new('sqs_url', provider: :sqs).publish({ body: 'value' }.to_json)
SXS::Publisher.new('sns_url', provider: :sns).publish({ body: 'value' }.to_json)
SXS::Publisher.new('some_key', provider: :redis).publish({ body: 'value' }.to_json)
SXS::Publisher.new('some_key', provider: :memory).publish({ body: 'value' }.to_json)
On development
and test
environment provider
be overwrited for the following:
development: :redis
test: :memory
To avoid this ovewrite you can specify the provider via ENV SXS_PROVIDER
. This will overwrites production
too.