Module: Deimos::Consume::MessageConsumption
- Extended by:
- ActiveSupport::Concern
- Includes:
- Phobos::Handler
- Included in:
- Deimos::Consumer
- Defined in:
- lib/deimos/consume/message_consumption.rb
Overview
Methods used by message-by-message (non-batch) consumers. These consumers are invoked for every individual message.
Instance Method Summary collapse
- #around_consume(payload, metadata) ⇒ void
-
#consume(_payload, _metadata) ⇒ void
Consume incoming messages.
Instance Method Details
#around_consume(payload, metadata) ⇒ void
This method returns an undefined value.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/deimos/consume/message_consumption.rb', line 14 def around_consume(payload, ) decoded_payload = payload.nil? ? nil : payload.dup = .dup benchmark = Benchmark.measure do _with_span do [:key] = decode_key([:key]) if self.class.config[:key_configured] decoded_payload = (payload) (decoded_payload, ) yield(decoded_payload, ) end end _handle_success(benchmark.real, decoded_payload, ) rescue StandardError => e _handle_error(e, decoded_payload, ) end |
#consume(_payload, _metadata) ⇒ void
This method returns an undefined value.
Consume incoming messages.
34 35 36 |
# File 'lib/deimos/consume/message_consumption.rb', line 34 def consume(_payload, ) raise NotImplementedError end |