Sha256: 7a29d99b5c6a231dc1d658cb133a4004f68b9762a875d95e90459dd5fb220487
Contents?: true
Size: 1.73 KB
Versions: 3
Compression:
Stored size: 1.73 KB
Contents
#require 'rocketjob' module ActiveJob module QueueAdapters # == Rocket Job adapter for Active Job # # Ruby's missing batch system. # # Read more about Rocket Job {here}[http://rocketjob.io]. # # To use Rocket Job set the queue_adapter config to +:rocket_job+. # # Rails.application.config.active_job.queue_adapter = :rocket_job class RocketJobAdapter def enqueue(active_job) #:nodoc: rocket_job = JobWrapper.perform_later(active_job.serialize) do |job| job.active_job_id = active_job.job_id job.active_job_class = active_job.class.name job.active_job_queue = active_job.queue_name job.description = active_job.class.name job.priority = active_job.priority if active_job.priority end active_job.provider_job_id = rocket_job.id.to_s rocket_job end def enqueue_at(active_job, timestamp) #:nodoc: rocket_job = JobWrapper.perform_later(active_job.serialize) do |job| job.active_job_id = active_job.job_id job.active_job_class = active_job.class.name job.active_job_queue = active_job.queue_name job.description = active_job.class.name job.priority = active_job.priority if active_job.priority job.run_at = Time.at(timestamp).utc end active_job.provider_job_id = rocket_job.id.to_s rocket_job end class JobWrapper < RocketJob::Job #:nodoc: key :active_job_id, String key :active_job_class, String key :active_job_queue, String def perform(job_data) Base.execute job_data end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems