Class: Phobos::Actions::ProcessBatch
- Inherits:
-
Object
- Object
- Phobos::Actions::ProcessBatch
- Includes:
- Instrumentation
- Defined in:
- lib/phobos/actions/process_batch.rb
Constant Summary
Constants included from Instrumentation
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(listener:, batch:, listener_metadata:) ⇒ ProcessBatch
constructor
A new instance of ProcessBatch.
Methods included from Instrumentation
#instrument, subscribe, unsubscribe
Constructor Details
#initialize(listener:, batch:, listener_metadata:) ⇒ ProcessBatch
Returns a new instance of ProcessBatch.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/phobos/actions/process_batch.rb', line 10 def initialize(listener:, batch:, listener_metadata:) @listener = listener @batch = batch @listener_metadata = @metadata = .merge( batch_size: batch..count, partition: batch.partition, offset_lag: batch.offset_lag ) end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/phobos/actions/process_batch.rb', line 8 def @metadata end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/phobos/actions/process_batch.rb', line 21 def execute instrument('listener.process_batch', @metadata) do || @batch..each do || Phobos::Actions::ProcessMessage.new( listener: @listener, message: , listener_metadata: @listener_metadata ).execute @listener.consumer.trigger_heartbeat end end end |