Class: ActiveJob::QueueAdapters::QueAdapter

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

Overview

Que adapter for Active Job

Que is a high-performance alternative to DelayedJob or QueueClassic that improves the reliability of your application by protecting your jobs with the same ACID guarantees as the rest of your data. Que is a queue for Ruby and PostgreSQL that manages jobs using advisory locks.

Read more about Que here.

To use Que set the queue_adapter config to :que.

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

Defined Under Namespace

Classes: JobWrapper

Instance Method Summary collapse

Instance Method Details

#enqueue(job) ⇒ Object

:nodoc:



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

def enqueue(job) #:nodoc:
  que_job = JobWrapper.enqueue job.serialize, priority: job.priority
  job.provider_job_id = que_job.attrs["job_id"]
  que_job
end

#enqueue_at(job, timestamp) ⇒ Object

:nodoc:



26
27
28
29
30
# File 'activejob/lib/active_job/queue_adapters/que_adapter.rb', line 26

def enqueue_at(job, timestamp) #:nodoc:
  que_job = JobWrapper.enqueue job.serialize, priority: job.priority, run_at: Time.at(timestamp)
  job.provider_job_id = que_job.attrs["job_id"]
  que_job
end