Class: ActiveJob::QueueAdapters::SneakersAdapter

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

Overview

Sneakers adapter for Active Job

A high-performance RabbitMQ background processing framework for Ruby. Sneakers is being used in production for both I/O and CPU intensive workloads, and have achieved the goals of high-performance and 0-maintenance, as designed.

Read more about Sneakers here.

To use Sneakers set the queue_adapter config to :sneakers.

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

Defined Under Namespace

Classes: JobWrapper

Instance Method Summary collapse

Constructor Details

#initializeSneakersAdapter

Returns a new instance of SneakersAdapter.


19
20
21
# File 'activejob/lib/active_job/queue_adapters/sneakers_adapter.rb', line 19

def initialize
  @monitor = Monitor.new
end

Instance Method Details

#enqueue(job) ⇒ Object

:nodoc:


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

def enqueue(job) #:nodoc:
  @monitor.synchronize do
    JobWrapper.from_queue job.queue_name
    JobWrapper.enqueue ActiveSupport::JSON.encode(job.serialize)
  end
end

#enqueue_at(job, timestamp) ⇒ Object

:nodoc:

Raises:

  • (NotImplementedError)

30
31
32
# File 'activejob/lib/active_job/queue_adapters/sneakers_adapter.rb', line 30

def enqueue_at(job, timestamp) #:nodoc:
  raise NotImplementedError, "This queueing backend does not support scheduling jobs. To see what features are supported go to http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html"
end