Method: Kafka::Protocol::OffsetFetchResponse.decode

Defined in:
lib/kafka/protocol/offset_fetch_response.rb

.decode(decoder) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/kafka/protocol/offset_fetch_response.rb', line 33

def self.decode(decoder)
  topics = decoder.array {
    topic = decoder.string

    partitions = decoder.array {
      partition = decoder.int32

      info = PartitionOffsetInfo.new(
        offset: decoder.int64,
        metadata: decoder.string,
        error_code: decoder.int16,
      )

      [partition, info]
    }

    [topic, Hash[partitions]]
  }

  new(topics: Hash[topics])
end