Class: ActiveJob::QueueAdapters::DelayedJobAdapter

Inherits:
Object
  • Object
show all
Defined in:
activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb

Overview

Delayed Job adapter for Active Job

Delayed::Job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. Although DJ can have many storage backends, one of the most used is based on Active Record. Read more about Delayed Job here.

To use Delayed Job, set the queue_adapter config to :delayed_job.

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

Defined Under Namespace

Classes: JobWrapper

Class Method Summary collapse

Class Method Details

.enqueue(job) ⇒ Object

:nodoc:


17
18
19
# File 'activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb', line 17

def enqueue(job) #:nodoc:
  Delayed::Job.enqueue(JobWrapper.new(job.serialize), queue: job.queue_name)
end

.enqueue_at(job, timestamp) ⇒ Object

:nodoc:


21
22
23
# File 'activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb', line 21

def enqueue_at(job, timestamp) #:nodoc:
  Delayed::Job.enqueue(JobWrapper.new(job.serialize), queue: job.queue_name, run_at: Time.at(timestamp))
end