Class: Kafka::Protocol::RequestMessage

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

Constant Summary collapse

API_VERSION =
0

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, api_version: API_VERSION, correlation_id:, client_id:, request:) ⇒ RequestMessage

Returns a new instance of RequestMessage.


6
7
8
9
10
11
12
# File 'lib/kafka/protocol/request_message.rb', line 6

def initialize(api_key:, api_version: API_VERSION, correlation_id:, client_id:, request:)
  @api_key = api_key
  @api_version = api_version
  @correlation_id = correlation_id
  @client_id = client_id
  @request = request
end

Instance Method Details

#encode(encoder) ⇒ Object


14
15
16
17
18
19
20
21
# File 'lib/kafka/protocol/request_message.rb', line 14

def encode(encoder)
  encoder.write_int16(@api_key)
  encoder.write_int16(@api_version)
  encoder.write_int32(@correlation_id)
  encoder.write_string(@client_id)

  @request.encode(encoder)
end