Class: Kafka::Protocol::MetadataRequest

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

Instance Method Summary collapse

Constructor Details

#initialize(topics: []) ⇒ MetadataRequest

A request for cluster metadata.

Parameters:

  • topics (Array<String>) (defaults to: [])


10
11
12
# File 'lib/kafka/protocol/metadata_request.rb', line 10

def initialize(topics: [])
  @topics = topics
end

Instance Method Details

#api_keyObject



14
15
16
# File 'lib/kafka/protocol/metadata_request.rb', line 14

def api_key
  TOPIC_METADATA_API
end

#api_versionObject



18
19
20
# File 'lib/kafka/protocol/metadata_request.rb', line 18

def api_version
  1
end

#encode(encoder) ⇒ Object



26
27
28
# File 'lib/kafka/protocol/metadata_request.rb', line 26

def encode(encoder)
  encoder.write_array(@topics) {|topic| encoder.write_string(topic) }
end

#response_classObject



22
23
24
# File 'lib/kafka/protocol/metadata_request.rb', line 22

def response_class
  Protocol::MetadataResponse
end