Class: KafkaSyrup::Protocol::Response

Inherits:
Base
  • Object
show all
Defined in:
lib/kafka_syrup/protocol/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #config, #defaults, #initialize

Methods included from Utils

#load_args, #log

Constructor Details

This class inherits a constructor from KafkaSyrup::Protocol::Base

Instance Attribute Details

#correlation_idObject

Returns the value of attribute correlation_id.



5
6
7
# File 'lib/kafka_syrup/protocol/response.rb', line 5

def correlation_id
  @correlation_id
end

Instance Method Details

#decode(io) ⇒ Object



16
17
18
19
# File 'lib/kafka_syrup/protocol/response.rb', line 16

def decode(io)
  super(io)
  self.correlation_id = E.read_int32(io)
end

#encode(&block) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/kafka_syrup/protocol/response.rb', line 7

def encode(&block)
  super do
    [
      E.write_int32(correlation_id.to_i),
      block_given? ? yield : ""
    ].join
  end
end