Class: ActiveJob::QueueAdapters::SneakersAdapter

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

Overview

Sneakers adapter for Active Job

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.



13
14
15
# File 'lib/active_job/queue_adapters/sneakers_adapter.rb', line 13

def initialize
  @monitor = Monitor.new
end

Instance Method Details

#enqueue(job) ⇒ Object



17
18
19
20
21
22
# File 'lib/active_job/queue_adapters/sneakers_adapter.rb', line 17

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

#enqueue_at(job, timestamp) ⇒ Object

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/active_job/queue_adapters/sneakers_adapter.rb', line 24

def enqueue_at(job, timestamp)
  raise NotImplementedError, 'This queueing backend does not support scheduling jobs.'
end