class ActiveJob::QueueAdapters::ShoryukenWaiterAdapter

Shoryuken::Waiter adapter for Active Job

Shoryuken (“sho-ryu-ken”) is a super-efficient AWS SQS thread based message processor. Shoryuken::Waiter allows messages to be delayed arbitrarily far into the future, which is not possible with Shoryuken on its own, as it is limited by SQS’s 15 minute maximum delay.

Read more about Shoryuken here. Read more about Shoryuken::Waiter here.

To use Shoryuken::Waiter set the queue_adapter config to :shoryuken_waiter.

Rails.application.config.active_job.queue_adapter = :shoryuken_waiter

Constants

JobWrapper

Private Class Methods

item(job, timestamp) click to toggle source
# File lib/shoryuken/waiter/extensions/active_job_adapter.rb, line 51
def item(job, timestamp)
  {
    scheduler: Shoryuken::Waiter::TABLE_PRIMARY_ITEM_KEY_VALUE,
    job_id: job.serialize["job_id"],
    perform_at: timestamp,
    sqs_message_body: job.serialize,
    sqs_message_attributes: message_attributes
  }
end
message_attributes() click to toggle source
# File lib/shoryuken/waiter/extensions/active_job_adapter.rb, line 42
def message_attributes
  @message_attributes ||= {
    "shoryuken_class" => {
      string_value: JobWrapper.to_s,
      data_type: "String"
    }
  }
end