Class: WaterDrop::Instrumentation::Callbacks::Delivery

Inherits:
Object
  • Object
show all
Defined in:
lib/water_drop/instrumentation/callbacks/delivery.rb

Overview

Note:

We don’t have to provide client_name here as this callback is per client instance

Creates a callable that we want to run upon each message delivery or failure

Instance Method Summary collapse

Constructor Details

#initialize(producer_id, monitor) ⇒ Delivery

Returns a new instance of Delivery.

Parameters:



12
13
14
15
# File 'lib/water_drop/instrumentation/callbacks/delivery.rb', line 12

def initialize(producer_id, monitor)
  @producer_id = producer_id
  @monitor = monitor
end

Instance Method Details

#call(delivery_report) ⇒ Object

Emits delivery details to the monitor

Parameters:

  • delivery_report (Rdkafka::Producer::DeliveryReport)

    delivery report



19
20
21
22
23
24
25
26
# File 'lib/water_drop/instrumentation/callbacks/delivery.rb', line 19

def call(delivery_report)
  @monitor.instrument(
    'message.acknowledged',
    producer_id: @producer_id,
    offset: delivery_report.offset,
    partition: delivery_report.partition
  )
end