Class: Kafka::Protocol::InitProducerIDRequest

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

Instance Method Summary collapse

Constructor Details

#initialize(transactional_id: nil, transactional_timeout:) ⇒ InitProducerIDRequest

Returns a new instance of InitProducerIDRequest.



6
7
8
9
# File 'lib/kafka/protocol/init_producer_id_request.rb', line 6

def initialize(transactional_id: nil, transactional_timeout:)
  @transactional_id = transactional_id
  @transactional_timeout = transactional_timeout
end

Instance Method Details

#api_keyObject



11
12
13
# File 'lib/kafka/protocol/init_producer_id_request.rb', line 11

def api_key
  INIT_PRODUCER_ID_API
end

#encode(encoder) ⇒ Object



19
20
21
22
23
# File 'lib/kafka/protocol/init_producer_id_request.rb', line 19

def encode(encoder)
  encoder.write_string(@transactional_id)
  # Timeout is in ms unit
  encoder.write_int32(@transactional_timeout * 1000)
end

#response_classObject



15
16
17
# File 'lib/kafka/protocol/init_producer_id_request.rb', line 15

def response_class
  InitProducerIDResponse
end