lib/rdkafka/producer/delivery_handle.rb in rdkafka-0.16.0.beta1 vs lib/rdkafka/producer/delivery_handle.rb in rdkafka-0.16.0

- old
+ new

@@ -12,10 +12,14 @@ :topic_name, :pointer # @return [Object, nil] label set during message production or nil by default attr_accessor :label + # @return [String] topic where we are trying to send the message + # We use this instead of reading from `topic_name` pointer to save on memory allocations + attr_accessor :topic + # @return [String] the name of the operation (e.g. "delivery") def operation_name "delivery" end @@ -24,10 +28,10 @@ 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, + topic, self[:response] != 0 ? RdkafkaError.new(self[:response]) : nil, label ) end end