Sha256: 997b925d1cd43625372b8a4a02ede4b5d9b65b5a104f09cccf7aeff7c3e645d2

Contents?: true

Size: 1.16 KB

Versions: 35

Compression:

Stored size: 1.16 KB

Contents

require 'que'

module ActiveJob
  module QueueAdapters
    # == Que adapter for Active Job
    #
    # Que is a high-performance alternative to DelayedJob or QueueClassic that
    # improves the reliability of your application by protecting your jobs with
    # the same ACID guarantees as the rest of your data. Que is a queue for
    # Ruby and PostgreSQL that manages jobs using advisory locks.
    #
    # Read more about Que {here}[https://github.com/chanks/que].
    #
    # To use Que set the queue_adapter config to +:que+.
    #
    #   Rails.application.config.active_job.queue_adapter = :que
    class QueAdapter
      def enqueue(job) #:nodoc:
        que_job = JobWrapper.enqueue job.serialize, priority: job.priority
        job.provider_job_id = que_job.attrs["job_id"]
        que_job
      end

      def enqueue_at(job, timestamp) #:nodoc:
        que_job = JobWrapper.enqueue job.serialize, priority: job.priority, run_at: Time.at(timestamp)
        job.provider_job_id = que_job.attrs["job_id"]
        que_job
      end

      class JobWrapper < Que::Job #:nodoc:
        def run(job_data)
          Base.execute job_data
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 4 rubygems

Version Path
activejob-5.0.7.2 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.7.1 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.7 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.6 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.6.rc1 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.5 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.5.rc2 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.5.rc1 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.4 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.4.rc1 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.3 lib/active_job/queue_adapters/que_adapter.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activejob-5.0.2/lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.2 lib/active_job/queue_adapters/que_adapter.rb
activejob-5.0.2.rc1 lib/active_job/queue_adapters/que_adapter.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/queue_adapters/que_adapter.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/queue_adapters/que_adapter.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/queue_adapters/que_adapter.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/queue_adapters/que_adapter.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/queue_adapters/que_adapter.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/queue_adapters/que_adapter.rb