Class: Karafka::Pro::ActiveJob::Dispatcher
- Inherits:
-
ActiveJob::Dispatcher
- Object
- ActiveJob::Dispatcher
- Karafka::Pro::ActiveJob::Dispatcher
- Defined in:
- lib/karafka/pro/active_job/dispatcher.rb
Overview
Pro dispatcher that sends the ActiveJob job to a proper topic based on the queue name and that allows to inject additional options into the producer, effectively allowing for a much better and more granular control over the dispatch and consumption process.
Instance Method Summary collapse
Instance Method Details
#call(job) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/karafka/pro/active_job/dispatcher.rb', line 36 def call(job) ::Karafka.producer.public_send( fetch_option(job, :dispatch_method, DEFAULTS), dispatch_details(job).merge!( topic: job.queue_name, payload: ::ActiveSupport::JSON.encode(job.serialize) ) ) end |