Sha256: dd769ec3a911a8b335e6ad7bcb33646f07c329917f0eb6986fb227104b7c0e6e

Contents?: true

Size: 1.04 KB

Versions: 51

Compression:

Stored size: 1.04 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
      class << self
        def enqueue(job) #:nodoc:
          JobWrapper.enqueue job.serialize, queue: job.queue_name
        end

        def enqueue_at(job, timestamp) #:nodoc:
          JobWrapper.enqueue job.serialize, queue: job.queue_name, run_at: Time.at(timestamp)
        end
      end

      class JobWrapper < Que::Job #:nodoc:
        def run(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/que_adapter.rb
activejob-4.2.11.2 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.11.1 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.11 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.10 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.10.rc1 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.9 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.9.rc2 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.9.rc1 lib/active_job/queue_adapters/que_adapter.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activejob-4.2.8/lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.8 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.8.rc1 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.7.1 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.7 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.7.rc1 lib/active_job/queue_adapters/que_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/que_adapter.rb
activejob-4.2.6 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.6.rc1 lib/active_job/queue_adapters/que_adapter.rb
activejob-4.2.5.2 lib/active_job/queue_adapters/que_adapter.rb
activejob-lock-0.0.2 rails/activejob/lib/active_job/queue_adapters/que_adapter.rb