Class: Karafka::ActiveJob::Consumer
- Inherits:
-
BaseConsumer
- Object
- BaseConsumer
- Karafka::ActiveJob::Consumer
- Defined in:
- lib/karafka/active_job/consumer.rb
Overview
This is the consumer for ActiveJob that eats the messages enqueued with it one after another. It marks the offset after each message, so we make sure, none of the jobs is executed twice
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseConsumer
#client, #coordinator, #id, #messages, #producer
Instance Method Summary collapse
-
#consume ⇒ Object
Executes the ActiveJob logic.
Methods inherited from BaseConsumer
#initialize, #inspect, #on_after_consume, #on_before_consume, #on_before_schedule_consume, #on_before_schedule_eofed, #on_before_schedule_idle, #on_before_schedule_revoked, #on_before_schedule_shutdown, #on_consume, #on_eofed, #on_idle, #on_initialized, #on_revoked, #on_shutdown, #on_wrap
Constructor Details
This class inherits a constructor from Karafka::BaseConsumer
Instance Method Details
#consume ⇒ Object
Note:
ActiveJob does not support batches, so we just run one message after another
Executes the ActiveJob logic
15 16 17 18 19 20 21 22 23 |
# File 'lib/karafka/active_job/consumer.rb', line 15 def consume .each do || break if ::Karafka::App.stopping? consume_job() mark_as_consumed() end end |