Sha256: bbf277d5b0996ebdf15438efab54ff198fc13d8796d318a679cd5baa0b64d45a

Contents?: true

Size: 1.24 KB

Versions: 51

Compression:

Stored size: 1.24 KB

Contents

require 'sucker_punch'

module ActiveJob
  module QueueAdapters
    # == 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}[https://github.com/brandonhilkert/sucker_punch].
    #
    # To use Sucker Punch set the queue_adapter config to +:sucker_punch+.
    #
    #   Rails.application.config.active_job.queue_adapter = :sucker_punch
    class SuckerPunchAdapter
      class << self
        def enqueue(job) #:nodoc:
          JobWrapper.new.async.perform job.serialize
        end

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

      class JobWrapper #:nodoc:
        include SuckerPunch::Job

        def perform(job_data)
          Base.execute job_data
        end
      end
    end
  end
end

Version data entries

51 entries across 50 versions & 8 rubygems

Version Path
activejob-4.2.11.3 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.11.2 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.11.1 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.11 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.10 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.10.rc1 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.9 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.9.rc2 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.9.rc1 lib/active_job/queue_adapters/sucker_punch_adapter.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activejob-4.2.8/lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.8 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.8.rc1 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.7.1 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.7 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.7.rc1 lib/active_job/queue_adapters/sucker_punch_adapter.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.6 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.6.rc1 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-4.2.5.2 lib/active_job/queue_adapters/sucker_punch_adapter.rb
activejob-lock-0.0.2 rails/activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb