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

Instance Method Summary collapse

Instance Method Details

#enqueue(job) ⇒ Object

:nodoc:


16
17
18
# File 'activejob/lib/active_job/queue_adapters/backburner_adapter.rb', line 16

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

#enqueue_at(job, timestamp) ⇒ Object

:nodoc:


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

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