Sha256: 138f0092f554c0835eb975d60cec279b2299228805f9e9a065b403c0d967dd55

Contents?: true

Size: 1.12 KB

Versions: 76

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

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, pri: job.priority)
      end

      def enqueue_at(job, timestamp) #:nodoc:
        delay = timestamp - Time.current.to_f
        Backburner::Worker.enqueue(JobWrapper, [job.serialize], queue: job.queue_name, pri: job.priority, 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

76 entries across 76 versions & 7 rubygems

Version Path
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/activejob-6.0.2.1/lib/active_job/queue_adapters/backburner_adapter.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/activejob-6.0.2.1/lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.2.1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.2 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.2.rc2 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.2.rc1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.1 lib/active_job/queue_adapters/backburner_adapter.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activejob-6.0.0/lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.1.rc1 lib/active_job/queue_adapters/backburner_adapter.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activejob-6.0.0/lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.0 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.0.rc2 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.0.rc1 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.0.beta3 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.0.beta2 lib/active_job/queue_adapters/backburner_adapter.rb
activejob-6.0.0.beta1 lib/active_job/queue_adapters/backburner_adapter.rb