-
-
Notifications
You must be signed in to change notification settings - Fork 290
From Sidekiq to Shoryuken
Pablo Cantero edited this page May 14, 2015
·
29 revisions
Shoryuken is a drop-in replacement for Sidekiq, the code changes should be minor s/sidekiq/shoryuken
. But as Shoryuken "reads" messages from SQS, instead of Redis, you will probably need a three steps migration:
- Stop sending jobs to Sidekiq
- Start using Shoryuken
- Keep Sidekiq running until it consumes all pending jobs.
class MyWorker
include Sidekiq::Worker
sidekiq_options queue: 'my_queue'
def perform(arg)
# ...
end
end
class MyWorker
include Shoryuken::Worker
shoryuken_options queue: 'my_queue', auto_delete: true
def perform(sqs_msg, arg)
# ...
end
end
:concurrency: 25
:pidfile: tmp/pids/sidekiq.pid
:queues:
- default
- [myqueue, 2]
:concurrency: 25
:pidfile: tmp/pids/shoryuken.pid
:queues:
- default
- [myqueue, 2]
If you are not using IAM roles for EC2, you will need the ENV variables below exported.
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
or the aws
defined in shoryuken.yml.
aws:
access_key_id: ...
secret_access_key: ...
region: ...
MyWorker.perform_async('test')
MyWorker.perform_async('test')
bundle exec sidekiq -r ./my_worker.rb -q my_queue
bundle exec shoryuken -r ./my_worker.rb -q my_queue