Class: Kafka::Protocol::OffsetFetchRequest

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

Instance Method Summary collapse

Constructor Details

#initialize(group_id:, topics:) ⇒ OffsetFetchRequest

Returns a new instance of OffsetFetchRequest.



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

def initialize(group_id:, topics:)
  @group_id = group_id
  @topics = topics
end

Instance Method Details

#api_keyObject



9
10
11
# File 'lib/kafka/protocol/offset_fetch_request.rb', line 9

def api_key
  OFFSET_FETCH_API
end

#api_versionObject



13
14
15
# File 'lib/kafka/protocol/offset_fetch_request.rb', line 13

def api_version
  1
end

#encode(encoder) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/kafka/protocol/offset_fetch_request.rb', line 21

def encode(encoder)
  encoder.write_string(@group_id)

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

    encoder.write_array(partitions) do |partition|
      encoder.write_int32(partition)
    end
  end
end

#response_classObject



17
18
19
# File 'lib/kafka/protocol/offset_fetch_request.rb', line 17

def response_class
  OffsetFetchResponse
end