123456789_123456789_123456789_123456789_123456789_

Class: ActiveJob::QueueAdapters::ResqueAdapter

Relationships & Source Files
Namespace Children
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActiveJob::QueueAdapters::AbstractAdapter
Defined in: activejob/lib/active_job/queue_adapters/resque_adapter.rb

Overview

Resque adapter for Active Job

Resque (pronounced like “rescue”) is a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later.

Read more about Resque here.

To use Resque set the queue_adapter config to :resque.

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

Instance Method Summary

AbstractAdapter - Inherited

Instance Method Details

#enqueue(job)

This method is for internal use only.
[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/resque_adapter.rb', line 31

def enqueue(job) # :nodoc:
  JobWrapper.instance_variable_set(:@queue, job.queue_name)
  Resque.enqueue_to job.queue_name, JobWrapper, job.serialize
end

#enqueue_at(job, timestamp)

This method is for internal use only.
[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/resque_adapter.rb', line 36

def enqueue_at(job, timestamp) # :nodoc:
  unless Resque.respond_to?(:enqueue_at_with_queue)
    raise NotImplementedError, "To be able to schedule jobs with Resque you need the " \
      "resque-scheduler gem. Please add it to your Gemfile and run bundle install"
  end
  Resque.enqueue_at_with_queue job.queue_name, timestamp, JobWrapper, job.serialize
end