Shoryuken requires:
- Ruby 3.2+
- Rails 7.2+ (for Rails/ActiveJob integration)
- aws-sdk-sqs >= 1.66
Add Shoryuken to your Gemfile:
gem 'shoryuken'Run bundler:
bundle installShoryuken uses the AWS SDK for Ruby and its usual credential sources. See [[Configure the AWS Client]].
# hello_worker.rb
class HelloWorker
include Shoryuken::Worker
shoryuken_options queue: 'hello', auto_delete: true
def perform(sqs_msg, name)
puts "Hello, #{name}"
end
endbundle exec shoryuken sqs create hellobundle exec shoryuken -q hello -r ./hello_worker.rbrequire 'shoryuken'
require_relative 'hello_worker'
HelloWorker.perform_async('Ken')# app/jobs/hello_job.rb
class HelloJob < ActiveJob::Base
queue_as 'hello'
def perform(name)
puts "Hello, #{name}"
end
endbundle exec shoryuken sqs create hello# config/application.rb
module YourApp
class Application < Rails::Application
config.active_job.queue_adapter = :shoryuken
end
endbundle exec shoryuken -q hello -RThe -R flag loads your Rails application. For middleware and other settings, see the initializer in [[Rails Integration Active Job]].
HelloJob.perform_later('Ken')For more complex setups, create a configuration file:
# config/shoryuken.yml
concurrency: 25
delay: 0
queues:
- [default, 1]
- [high_priority, 2]Start Shoryuken with the configuration file:
bundle exec shoryuken -R -C config/shoryuken.ymlSee [[Shoryuken options]] for all available configuration options.