class ActiveJob::QueueAdapters::QueueClassicAdapter
Rails.application.config.active_job.queue_adapter = :queue_classic
To use queue_classic set the queue_adapter config to :queue_classic
.
Read more about queue_classic here.
beanstalkd, 0mq) is undesirable.
production environment and that adding another dependency (e.g. redis,
queue_classic assumes that you are already using PostgreSQL in your
database load while providing a simple, intuitive developer experience.
queue. queue_classic specializes in concurrent locking and minimizing
queue_classic provides a simple interface to a PostgreSQL-backed message
== queue_classic adapter for Active Job
def build_queue(queue_name)
ActiveJob::QueueAdapters::QueueClassicAdapter and override the
If you have a custom QC::Queue subclass you'll need to subclass
Builds a QC::Queue object to schedule jobs on.
def build_queue(queue_name) QC::Queue.new(queue_name) end
def enqueue(job) #:nodoc:
def enqueue(job) #:nodoc: qc_job = build_queue(job.queue_name).enqueue("#{JobWrapper.name}.perform", job.serialize) job.provider_job_id = qc_job["id"] if qc_job.is_a?(Hash) qc_job end
def enqueue_at(job, timestamp) #:nodoc:
def enqueue_at(job, timestamp) #:nodoc: queue = build_queue(job.queue_name) unless queue.respond_to?(:enqueue_at) raise NotImplementedError, "To be able to schedule jobs with queue_classic " \ "the QC::Queue needs to respond to `enqueue_at(timestamp, method, *args)`. " \ "You can implement this yourself or you can use the queue_classic-later gem." end qc_job = queue.enqueue_at(timestamp, "#{JobWrapper.name}.perform", job.serialize) job.provider_job_id = qc_job["id"] if qc_job.is_a?(Hash) qc_job end