Module: Karafka::Pro::Processing::Strategies::Aj::LrjMomVp
- Includes:
- Default, Vp::Default
- Defined in:
- lib/karafka/pro/processing/strategies/aj/lrj_mom_vp.rb
Overview
ActiveJob enabled Long-Running Job enabled Manual offset management enabled Virtual Partitions enabled
Constant Summary collapse
- FEATURES =
Features for this strategy
%i[ active_job long_running_job manual_offset_management virtual_partitions ].freeze
Instance Method Summary collapse
-
#handle_after_consume ⇒ Object
Standard flow without any features.
-
#handle_before_schedule_consume ⇒ Object
No actions needed for the standard flow here.
-
#handle_revoked ⇒ Object
LRJ cannot resume here.
Methods included from Vp::Default
#collapse_until!, #collapsed?, #failing?, #mark_as_consumed, #mark_as_consumed!, #mark_in_transaction, #synchronize
Methods included from Default
#handle_before_consume, #handle_before_schedule_tick, #handle_consume, #handle_tick, #mark_as_consumed, #mark_as_consumed!, #mark_in_transaction, #store_offset_metadata, #transaction
Methods included from Karafka::Processing::Strategies::Default
#commit_offsets, #commit_offsets!, #handle_before_consume, #handle_consume, #handle_eofed, #handle_idle, #handle_initialized, #handle_shutdown, #mark_as_consumed, #mark_as_consumed!
Methods included from Karafka::Processing::Strategies::Base
#handle_before_consume, #handle_consume, #handle_idle, #handle_shutdown
Instance Method Details
#handle_after_consume ⇒ Object
Standard flow without any features
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/karafka/pro/processing/strategies/aj/lrj_mom_vp.rb', line 45 def handle_after_consume coordinator.on_finished do || if coordinator.success? coordinator.pause_tracker.reset mark_as_consumed() unless revoked? # no need to check for manual seek because AJ consumer is internal and # fully controlled by us seek(coordinator.seek_offset, false) unless revoked? resume else # If processing failed, we need to pause # For long running job this will overwrite the default never-ending pause and # will cause the processing to keep going after the error backoff retry_after_pause end end end |
#handle_before_schedule_consume ⇒ Object
No actions needed for the standard flow here
36 37 38 39 40 41 42 |
# File 'lib/karafka/pro/processing/strategies/aj/lrj_mom_vp.rb', line 36 def handle_before_schedule_consume super coordinator.on_enqueued do pause(:consecutive, Strategies::Lrj::Default::MAX_PAUSE_TIME, false) end end |
#handle_revoked ⇒ Object
LRJ cannot resume here. Only in handling the after consumption
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/karafka/pro/processing/strategies/aj/lrj_mom_vp.rb', line 67 def handle_revoked coordinator.on_revoked do coordinator.revoke end Karafka.monitor.instrument('consumer.revoke', caller: self) Karafka.monitor.instrument('consumer.revoked', caller: self) do revoked end ensure coordinator.decrement(:revoked) end |