Class: Rdkafka::Producer::DeliveryHandle

Inherits:
AbstractHandle show all
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

AbstractHandle::REGISTRY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractHandle

#initialize, #pending?, #raise_error, register, remove, #unlock, #wait

Methods included from Helpers::Time

#monotonic_now

Constructor Details

This class inherits a constructor from Rdkafka::AbstractHandle

Instance Attribute Details

#labelObject?

Returns label set during message production or nil by default.

Returns:

  • (Object, nil)

    label set during message production or nil by default



15
16
17
# File 'lib/rdkafka/producer/delivery_handle.rb', line 15

def label
  @label
end

#topicString

We use this instead of reading from topic_name pointer to save on memory allocations

Returns:

  • (String)

    topic where we are trying to send the message



19
20
21
# File 'lib/rdkafka/producer/delivery_handle.rb', line 19

def topic
  @topic
end

Instance Method Details

#create_resultDeliveryReport

Returns a report on the delivery of the message.

Returns:



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rdkafka/producer/delivery_handle.rb', line 27

def create_result
  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
    topic,
    self[:response] != 0 ? RdkafkaError.new(self[:response]) : nil,
    label
  )
end

#operation_nameString

Returns the name of the operation (e.g. “delivery”).

Returns:

  • (String)

    the name of the operation (e.g. “delivery”)



22
23
24
# File 'lib/rdkafka/producer/delivery_handle.rb', line 22

def operation_name
  "delivery"
end