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:


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

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:


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

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