Class: Kafka::Protocol::OffsetCommitRequest

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

Instance Method Summary collapse

Constructor Details

#initialize(group_id:, generation_id:, member_id:, retention_time: 0, offsets:) ⇒ OffsetCommitRequest

Returns a new instance of OffsetCommitRequest.


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

def initialize(group_id:, generation_id:, member_id:, retention_time: 0, offsets:)
  @group_id = group_id
  @generation_id = generation_id
  @member_id = member_id
  @retention_time = retention_time
  @offsets = offsets
end

Instance Method Details

#api_keyObject


4
5
6
# File 'lib/kafka/protocol/offset_commit_request.rb', line 4

def api_key
  8
end

#api_versionObject


8
9
10
# File 'lib/kafka/protocol/offset_commit_request.rb', line 8

def api_version
  2
end

#encode(encoder) ⇒ Object


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/kafka/protocol/offset_commit_request.rb', line 24

def encode(encoder)
  encoder.write_string(@group_id)
  encoder.write_int32(@generation_id)
  encoder.write_string(@member_id)
  encoder.write_int64(@retention_time)

  encoder.write_array(@offsets) do |topic, partitions|
    encoder.write_string(topic)

    encoder.write_array(partitions) do |partition, offset|
      encoder.write_int32(partition)
      encoder.write_int64(offset)
      encoder.write_string(nil) # metadata
    end
  end
end

#response_classObject


12
13
14
# File 'lib/kafka/protocol/offset_commit_request.rb', line 12

def response_class
  OffsetCommitResponse
end