Class: Rdkafka::Producer::DeliveryHandle
- Inherits:
-
AbstractHandle
- Object
- FFI::Struct
- AbstractHandle
- Rdkafka::Producer::DeliveryHandle
- Defined in:
- lib/rdkafka/producer/delivery_handle.rb
Overview
Handle to wait for a delivery report which is returned when producing a message.
Constant Summary
Constants inherited from AbstractHandle
Instance Method Summary collapse
-
#create_result ⇒ DeliveryReport
A report on the delivery of the message.
-
#operation_name ⇒ String
The name of the operation (e.g. "delivery").
Methods inherited from AbstractHandle
#pending?, #raise_error, register, remove, #wait
Methods included from Helpers::Time
Instance Method Details
#create_result ⇒ DeliveryReport
Returns a report on the delivery of the message.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rdkafka/producer/delivery_handle.rb', line 20 def create_result if self[:response] == 0 DeliveryReport.new( self[:partition], self[:offset], self[:topic_name].read_string ) else DeliveryReport.new( self[:partition], self[:offset], # For part of errors, we will not get a topic name reference and in cases like this # we should not return it self[:topic_name].null? ? nil : self[:topic_name].read_string, Rdkafka::RdkafkaError.build(self[:response]) ) end end |
#operation_name ⇒ String
Returns the name of the operation (e.g. "delivery").
15 16 17 |
# File 'lib/rdkafka/producer/delivery_handle.rb', line 15 def operation_name "delivery" end |