Class: ActiveJob::QueueAdapters::SuckerPunchAdapter

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

Overview

Sucker Punch adapter for Active Job

Sucker Punch is a single-process Ruby asynchronous processing library. It's girl_friday and DSL sugar on top of Celluloid. With Celluloid's actor pattern, we can do asynchronous processing within a single process. This reduces costs of hosting on a service like Heroku along with the memory footprint of having to maintain additional jobs if hosting on a dedicated server. All queues can run within a single Rails/Sinatra process.

Read more about Sucker Punch here.

To use Sucker Punch set the queue_adapter config to :sucker_punch.

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

Defined Under Namespace

Classes: JobWrapper

Class Method Summary collapse

Class Method Details

.enqueue(job) ⇒ Object

:nodoc:


22
23
24
# File 'activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb', line 22

def enqueue(job) #:nodoc:
  JobWrapper.new.async.perform job.serialize
end

.enqueue_at(job, timestamp) ⇒ Object

:nodoc:

Raises:

  • (NotImplementedError)

26
27
28
# File 'activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb', line 26

def enqueue_at(job, timestamp) #:nodoc:
  raise NotImplementedError
end