Class: ActiveJob::QueueAdapters::ShoryukenLaterAdapter
- Inherits:
-
ShoryukenAdapter
- Object
- ShoryukenAdapter
- ActiveJob::QueueAdapters::ShoryukenLaterAdapter
- Defined in:
- lib/shoryuken/later/active_job_adapter.rb
Overview
Shoryuken::Later adapter for Active Job
Shoryuken (“sho-ryu-ken”) is a super-efficient AWS SQS thread based message processor. Shoryuken::Later allows messages to be delayed arbitrarily far into the future.
Read more about Shoryuken here. Read more about Shoryuken::Later here.
To use Shoryuken::Later set the queue_adapter config to :shoryuken_later
.
Rails.application.config.active_job.queue_adapter = :shoryuken_later
Constant Summary collapse
- JobWrapper =
ShoryukenAdapter::JobWrapper
Class Method Summary collapse
-
.enqueue_at(job, timestamp) ⇒ Object
:nodoc:.
Class Method Details
.enqueue_at(job, timestamp) ⇒ Object
:nodoc:
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/shoryuken/later/active_job_adapter.rb', line 28 def enqueue_at(job, ) #:nodoc: register_worker!(job) delay = ( - Time.current.to_f).round if delay > 15.minutes Shoryuken::Later::Client.create_item(Shoryuken::Later.default_table, perform_at: Time.current.to_i + delay.to_i, shoryuken_queue: job.queue_name, shoryuken_class: JobWrapper.to_s, shoryuken_args: JSON.dump(body: job.serialize, options: {})) else Shoryuken::Client.queues(job.queue_name).(message_body: job.serialize, message_attributes: , delay_seconds: delay) end end |