Sha256: ae5b26770f087bba61c74bcc73d2d8b601534661a57b00f3162dd579264e2fad

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Rdkafka
  class Producer
    # Delivery report for a successfully produced message.
    class DeliveryReport
      # The partition this message was produced to.
      # @return [Integer]
      attr_reader :partition

      # The offset of the produced message.
      # @return [Integer]
      attr_reader :offset

      # The name of the topic this message was produced to or nil in case delivery failed and we
      #   we not able to get the topic reference
      # @return [String, nil]
      attr_reader :topic_name

      # Error in case happen during produce.
      # @return [Integer]
      attr_reader :error

      # We alias the `#topic_name` under `#topic` to make this consistent with `Consumer::Message`
      # where the topic name is under `#topic` method. That way we have a consistent name that
      # is present in both places
      #
      # We do not remove the original `#topic_name` because of backwards compatibility
      alias topic topic_name

      private

      def initialize(partition, offset, topic_name = nil, error = nil)
        @partition = partition
        @offset = offset
        @topic_name = topic_name
        @error = error
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
karafka-rdkafka-0.14.4 lib/rdkafka/producer/delivery_report.rb
karafka-rdkafka-0.14.3 lib/rdkafka/producer/delivery_report.rb
karafka-rdkafka-0.14.2 lib/rdkafka/producer/delivery_report.rb