Class: KafkaSyrup::Protocol::ProduceResponse
- Inherits:
-
Response
show all
- Defined in:
- lib/kafka_syrup/protocol/produce_response.rb
Defined Under Namespace
Classes: Partition, Topic
Instance Attribute Summary collapse
Attributes inherited from Response
#correlation_id
Instance Method Summary
collapse
Methods inherited from Base
#==, #config, #initialize
Methods included from Utils
#load_args, #log
Instance Attribute Details
#topics ⇒ Object
Returns the value of attribute topics.
4
5
6
|
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 4
def topics
@topics
end
|
Instance Method Details
#add_topic(name) ⇒ Object
10
11
12
13
14
|
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 10
def add_topic(name)
topic = Topic.new(name, [])
topics << topic
topic
end
|
#decode(io) ⇒ Object
22
23
24
25
26
|
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 22
def decode(io)
super
self.topics = E.read_array(io, &Topic.method(:decode))
topics.flat_map(&:partitions).map(&:code).each(&KafkaResponseErrors.method(:raise_from_code))
end
|
#defaults ⇒ Object
6
7
8
|
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 6
def defaults
{ topics: [] }
end
|
#encode ⇒ Object
16
17
18
19
20
|
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 16
def encode
super do
E.write_array(topics)
end
end
|