Sha256: 08a01be6be17ba34c3e40c3a6518f751b6d7f6af53bd766d17e44f1ec3c74a1e

Contents?: true

Size: 1.23 KB

Versions: 59

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

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, queue: job.queue_name
        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, queue: job.queue_name, 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

59 entries across 59 versions & 4 rubygems

Version Path
activejob-6.1.7.10 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7.9 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7.8 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7.7 lib/active_job/queue_adapters/que_adapter.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activejob-6.1.6.1/lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7.6 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7.5 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7.4 lib/active_job/queue_adapters/que_adapter.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activejob-6.1.6.1/lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7.3 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7.2 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7.1 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.0.6.1 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.7 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.0.6 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.6.1 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.0.5.1 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.0.5 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.6 lib/active_job/queue_adapters/que_adapter.rb
activejob-6.1.5.1 lib/active_job/queue_adapters/que_adapter.rb