Class: ActiveJob::QueueAdapters::SidekiqAdapter
- Defined in:
- activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb
Overview
Sidekiq adapter for Active Job
Simple, efficient background processing for Ruby. Sidekiq uses threads to handle many jobs at the same time in the same process. It does not require Rails but will integrate tightly with it to make background processing dead simple.
Read more about Sidekiq here.
To use Sidekiq set the queue_adapter config to :sidekiq
.
Rails.application.config.active_job.queue_adapter = :sidekiq
Defined Under Namespace
Classes: JobWrapper
Instance Method Summary collapse
-
#enqueue(job) ⇒ Object
:nodoc:.
-
#enqueue_at(job, timestamp) ⇒ Object
:nodoc:.
Instance Method Details
#enqueue(job) ⇒ Object
:nodoc:
20 21 22 23 24 25 26 27 |
# File 'activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb', line 20 def enqueue(job) #:nodoc: # Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class, "queue" => job.queue_name, "args" => [ job.serialize ] end |
#enqueue_at(job, timestamp) ⇒ Object
:nodoc:
29 30 31 32 33 34 35 36 |
# File 'activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb', line 29 def enqueue_at(job, ) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => end |