class Kafka::Protocol::ProduceResponse

Attributes

throttle_time_ms[R]
topics[R]

Public Class Methods

decode(decoder) click to toggle source
# File lib/kafka/protocol/produce_response.rb, line 41
def self.decode(decoder)
  topics = decoder.array do
    topic = decoder.string

    partitions = decoder.array do
      PartitionInfo.new(
        partition: decoder.int32,
        error_code: decoder.int16,
        offset: decoder.int64,
        timestamp: Time.at(decoder.int64 / 1000.0),
      )
    end

    TopicInfo.new(topic: topic, partitions: partitions)
  end

  throttle_time_ms = decoder.int32

  new(topics: topics, throttle_time_ms: throttle_time_ms)
end
new(topics: [], throttle_time_ms: 0) click to toggle source
# File lib/kafka/protocol/produce_response.rb, line 28
def initialize(topics: [], throttle_time_ms: 0)
  @topics = topics
  @throttle_time_ms = throttle_time_ms
end

Public Instance Methods

each_partition() { |topic_info, partition_info| ... } click to toggle source
# File lib/kafka/protocol/produce_response.rb, line 33
def each_partition
  @topics.each do |topic_info|
    topic_info.partitions.each do |partition_info|
      yield topic_info, partition_info
    end
  end
end