Sha256: be97788823985f74dcab1d72549acb7ec32d3a75bde0fe5da10c5984bd0a43d3

Contents?: true

Size: 1.06 KB

Versions: 20

Compression:

Stored size: 1.06 KB

Contents

require "backburner"

module ActiveJob
  module QueueAdapters
    # == Backburner adapter for Active Job
    #
    # Backburner is a beanstalkd-powered job queue that can handle a very
    # high volume of jobs. You create background jobs and place them on
    # multiple work queues to be processed later. Read more about
    # Backburner {here}[https://github.com/nesquena/backburner].
    #
    # To use Backburner set the queue_adapter config to +:backburner+.
    #
    #   Rails.application.config.active_job.queue_adapter = :backburner
    class BackburnerAdapter
      def enqueue(job) #:nodoc:
        Backburner::Worker.enqueue JobWrapper, [ job.serialize ], queue: job.queue_name
      end

      def enqueue_at(job, timestamp) #:nodoc:
        delay = timestamp - Time.current.to_f
        Backburner::Worker.enqueue JobWrapper, [ job.serialize ], queue: job.queue_name, delay: delay
      end

      class JobWrapper #:nodoc:
        class << self
          def perform(job_data)
            Base.execute job_data
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
activejob-5.1.7 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.7.rc1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.6.2 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.6.1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.6 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.5 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.5.rc1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.4 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.4.rc1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.3 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.3.rc3 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.3.rc2 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.3.rc1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.2 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.2.rc1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.0 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.0.rc2 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.0.rc1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-5.1.0.beta1 lib/active_job/queue_adapters/backburner_adapter.rb