Module: Karafka::Pro::Processing::Strategies::AjLrjMomVp
- Includes:
- 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_enqueue ⇒ Object
No actions needed for the standard flow here.
-
#handle_revoked ⇒ Object
LRJ cannot resume here.
Methods included from Default
#handle_before_consume, #handle_consume
Methods included from Karafka::Processing::Strategies::Default
#handle_before_consume, #handle_consume, #handle_shutdown
Methods included from Karafka::Processing::Strategies::Base
#handle_before_consume, #handle_consume, #handle_shutdown
Instance Method Details
#handle_after_consume ⇒ Object
Standard flow without any features
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/karafka/pro/processing/strategies/aj_lrj_mom_vp.rb', line 41 def handle_after_consume coordinator.on_finished do || if coordinator.success? coordinator.pause_tracker.reset mark_as_consumed() unless revoked? || Karafka::App.stopping? seek(coordinator.seek_offset) 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_enqueue ⇒ Object
No actions needed for the standard flow here
34 35 36 37 38 |
# File 'lib/karafka/pro/processing/strategies/aj_lrj_mom_vp.rb', line 34 def handle_before_enqueue coordinator.on_enqueued do pause(coordinator.seek_offset, Lrj::MAX_PAUSE_TIME, false) end end |
#handle_revoked ⇒ Object
LRJ cannot resume here. Only in handling the after consumption
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/karafka/pro/processing/strategies/aj_lrj_mom_vp.rb', line 60 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 end |