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


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

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


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

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