Class: Kafka::Protocol::OffsetCommitResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/kafka/protocol/offset_commit_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(topics:) ⇒ OffsetCommitResponse

Returns a new instance of OffsetCommitResponse.



8
9
10
# File 'lib/kafka/protocol/offset_commit_response.rb', line 8

def initialize(topics:)
  @topics = topics
end

Instance Attribute Details

#topicsObject (readonly)

Returns the value of attribute topics.



6
7
8
# File 'lib/kafka/protocol/offset_commit_response.rb', line 6

def topics
  @topics
end

Class Method Details

.decode(decoder) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kafka/protocol/offset_commit_response.rb', line 12

def self.decode(decoder)
  topics = decoder.array {
    topic = decoder.string
    partitions = decoder.array {
      partition = decoder.int32
      error_code = decoder.int16

      [partition, error_code]
    }

    [topic, Hash[partitions]]
  }

  new(topics: Hash[topics])
end