123456789_123456789_123456789_123456789_123456789_

Class: ActiveJob::QueueAdapters::DelayedJobAdapter

Relationships & Source Files
Namespace Children
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActiveJob::QueueAdapters::AbstractAdapter
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

Instance Method Summary

AbstractAdapter - Inherited

Instance Method Details

#enqueue(job)

This method is for internal use only.
[ GitHub ]

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

def enqueue(job) # :nodoc:
  delayed_job = Delayed::Job.enqueue(JobWrapper.new(job.serialize), queue: job.queue_name, priority: job.priority)
  job.provider_job_id = delayed_job.id
  delayed_job
end

#enqueue_at(job, timestamp)

This method is for internal use only.
[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb', line 25

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