Class: Kafka::Protocol::JoinGroupRequest
- Inherits:
-
Object
- Object
- Kafka::Protocol::JoinGroupRequest
- Defined in:
- lib/kafka/protocol/join_group_request.rb
Constant Summary collapse
- PROTOCOL_TYPE =
"consumer"
Instance Method Summary collapse
- #api_key ⇒ Object
- #encode(encoder) ⇒ Object
-
#initialize(group_id:, session_timeout:, member_id:, topics: []) ⇒ JoinGroupRequest
constructor
A new instance of JoinGroupRequest.
- #response_class ⇒ Object
Constructor Details
#initialize(group_id:, session_timeout:, member_id:, topics: []) ⇒ JoinGroupRequest
Returns a new instance of JoinGroupRequest.
10 11 12 13 14 15 16 17 18 |
# File 'lib/kafka/protocol/join_group_request.rb', line 10 def initialize(group_id:, session_timeout:, member_id:, topics: []) @group_id = group_id @session_timeout = session_timeout * 1000 # Kafka wants ms. @member_id = member_id || "" @protocol_type = PROTOCOL_TYPE @group_protocols = { "standard" => ConsumerGroupProtocol.new(topics: ["test-messages"]), } end |
Instance Method Details
#api_key ⇒ Object
20 21 22 |
# File 'lib/kafka/protocol/join_group_request.rb', line 20 def api_key JOIN_GROUP_API end |
#encode(encoder) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/kafka/protocol/join_group_request.rb', line 28 def encode(encoder) encoder.write_string(@group_id) encoder.write_int32(@session_timeout) encoder.write_string(@member_id) encoder.write_string(@protocol_type) encoder.write_array(@group_protocols) do |name, | encoder.write_string(name) encoder.write_bytes(Encoder.encode_with()) end end |
#response_class ⇒ Object
24 25 26 |
# File 'lib/kafka/protocol/join_group_request.rb', line 24 def response_class JoinGroupResponse end |