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.



21
22
23
# File 'activejob/lib/active_job/queue_adapters/sneakers_adapter.rb', line 21

def initialize
  @monitor = Monitor.new
end

Instance Method Details

#enqueue(job) ⇒ Object

:nodoc:



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

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)


32
33
34
# File 'activejob/lib/active_job/queue_adapters/sneakers_adapter.rb', line 32

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