Class: ActiveJob::QueueAdapters::BackburnerAdapter

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

Overview

Backburner adapter for Active Job

Backburner is a beanstalkd-powered job queue that can handle a very high volume of jobs. You create background jobs and place them on multiple work queues to be processed later. Read more about Backburner here.

To use Backburner set the queue_adapter config to :backburner.

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

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/backburner_adapter.rb', line 17

def enqueue(job) #:nodoc:
  Backburner::Worker.enqueue JobWrapper, [ job.serialize ], queue: job.queue_name
end

.enqueue_at(job, timestamp) ⇒ Object

:nodoc:


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

def enqueue_at(job, timestamp) #:nodoc:
  delay = timestamp - Time.current.to_f
  Backburner::Worker.enqueue JobWrapper, [ job.serialize ], queue: job.queue_name, delay: delay
end