Module: WaterDrop::Producer::Async
- Included in:
- WaterDrop::Producer
- Defined in:
- lib/water_drop/producer/async.rb
Overview
Component for asynchronous producer operations
Instance Method Summary collapse
-
#produce_async(message) ⇒ Rdkafka::Producer::DeliveryHandle
Produces a message to Kafka and does not wait for results.
-
#produce_many_async(messages) ⇒ Array<Rdkafka::Producer::DeliveryHandle>
Produces many messages to Kafka and does not wait for them to be delivered.
Instance Method Details
#produce_async(message) ⇒ Rdkafka::Producer::DeliveryHandle
Produces a message to Kafka and does not wait for results
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/water_drop/producer/async.rb', line 16 def produce_async() ensure_active! () @monitor.instrument( 'message.produced_async', producer: self, message: ) { client.produce(**) } end |
#produce_many_async(messages) ⇒ Array<Rdkafka::Producer::DeliveryHandle>
Produces many messages to Kafka and does not wait for them to be delivered
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/water_drop/producer/async.rb', line 37 def produce_many_async() ensure_active! .each { || () } @monitor.instrument( 'messages.produced_async', producer: self, messages: ) do .map { || client.produce(**) } end end |