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:



18
19
20
# File 'activejob/lib/active_job/queue_adapters/backburner_adapter.rb', line 18

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

#enqueue_at(job, timestamp) ⇒ Object

:nodoc:



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

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