Class: ActiveJob::QueueAdapters::KarafkaAdapter
- Inherits:
-
Object
- Object
- ActiveJob::QueueAdapters::KarafkaAdapter
- Defined in:
- lib/active_job/queue_adapters/karafka_adapter.rb
Overview
Karafka adapter for enqueuing jobs This is here for ease of integration with ActiveJob.
Instance Method Summary collapse
-
#enqueue(job) ⇒ Object
Enqueues the job using the configured dispatcher.
-
#enqueue_all(jobs) ⇒ Integer
Enqueues multiple jobs in one go.
-
#enqueue_at(_job, _timestamp) ⇒ Object
Raises info, that Karafka backend does not support scheduling jobs.
Instance Method Details
#enqueue(job) ⇒ Object
Enqueues the job using the configured dispatcher
13 14 15 |
# File 'lib/active_job/queue_adapters/karafka_adapter.rb', line 13 def enqueue(job) ::Karafka::App.config.internal.active_job.dispatcher.dispatch(job) end |
#enqueue_all(jobs) ⇒ Integer
Enqueues multiple jobs in one go
20 21 22 23 |
# File 'lib/active_job/queue_adapters/karafka_adapter.rb', line 20 def enqueue_all(jobs) ::Karafka::App.config.internal.active_job.dispatcher.dispatch_many(jobs) jobs.size end |
#enqueue_at(_job, _timestamp) ⇒ Object
Raises info, that Karafka backend does not support scheduling jobs
29 30 31 |
# File 'lib/active_job/queue_adapters/karafka_adapter.rb', line 29 def enqueue_at(_job, ) raise NotImplementedError, 'This queueing backend does not support scheduling jobs.' end |