class ActiveJob::QueueAdapters::QueueClassicAdapter

Public Class Methods

build_queue(queue_name) click to toggle source

Builds a QC::Queue object to schedule jobs on.

If you have a custom QC::Queue subclass you’ll need to suclass ActiveJob::QueueAdapters::QueueClassicAdapter and override the build_queue method.

# File lib/active_job/queue_adapters/queue_classic_adapter.rb, line 26
def build_queue(queue_name)
  QC::Queue.new(queue_name)
end
enqueue(job) click to toggle source
# File lib/active_job/queue_adapters/queue_classic_adapter.rb, line 7
def enqueue(job)
  build_queue(job.queue_name).enqueue("#{JobWrapper.name}.perform", job.serialize)
end
enqueue_at(job, timestamp) click to toggle source
# File lib/active_job/queue_adapters/queue_classic_adapter.rb, line 11
def enqueue_at(job, timestamp)
  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
  queue.enqueue_at(timestamp, "#{JobWrapper.name}.perform", job.serialize)
end