Class: Kafka::Protocol::ProduceResponse
- Inherits:
-
Object
- Object
- Kafka::Protocol::ProduceResponse
- Defined in:
- lib/kafka/protocol/produce_response.rb
Defined Under Namespace
Classes: PartitionInfo, TopicInfo
Instance Attribute Summary collapse
-
#topics ⇒ Object
readonly
Returns the value of attribute topics.
Class Method Summary collapse
Instance Method Summary collapse
- #each_partition ⇒ Object
-
#initialize(topics: []) ⇒ ProduceResponse
constructor
A new instance of ProduceResponse.
Constructor Details
#initialize(topics: []) ⇒ ProduceResponse
Returns a new instance of ProduceResponse.
25 26 27 |
# File 'lib/kafka/protocol/produce_response.rb', line 25 def initialize(topics: []) @topics = topics end |
Instance Attribute Details
#topics ⇒ Object (readonly)
Returns the value of attribute topics.
23 24 25 |
# File 'lib/kafka/protocol/produce_response.rb', line 23 def topics @topics end |
Class Method Details
.decode(decoder) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/kafka/protocol/produce_response.rb', line 37 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, ) end TopicInfo.new(topic: topic, partitions: partitions) end new(topics: topics) end |
Instance Method Details
#each_partition ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/kafka/protocol/produce_response.rb', line 29 def each_partition @topics.each do |topic_info| topic_info.partitions.each do |partition_info| yield topic_info, partition_info end end end |