Sha256: 93825ec0b82afbf209ce889c066fd789dd796c82cbf04ae99b64fd958c1528d2
Contents?: true
Size: 1.16 KB
Versions: 12
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true # ActiveJob components to allow for jobs consumption with Karafka module ActiveJob # ActiveJob queue adapters module QueueAdapters # Karafka adapter for enqueuing jobs # This is here for ease of integration with ActiveJob. class KarafkaAdapter # Enqueues the job using the configured dispatcher # # @param job [Object] job that should be enqueued def enqueue(job) ::Karafka::App.config.internal.active_job.dispatcher.dispatch(job) end # Enqueues multiple jobs in one go # @param jobs [Array<Object>] jobs that we want to enqueue # @return [Integer] number of jobs enqueued (required by Rails) def enqueue_all(jobs) ::Karafka::App.config.internal.active_job.dispatcher.dispatch_many(jobs) jobs.size end # Raises info, that Karafka backend does not support scheduling jobs # # @param _job [Object] job we cannot enqueue # @param _timestamp [Time] time when job should run def enqueue_at(_job, _timestamp) raise NotImplementedError, 'This queueing backend does not support scheduling jobs.' end end end end
Version data entries
12 entries across 12 versions & 1 rubygems