tulios / kafkajs

A modern Apache Kafka client for node.js
https://kafka.js.org
MIT License
3.73k stars 526 forks source link

Add protocol findCoordinator v1 #165

Closed tulios closed 5 years ago

tulios commented 6 years ago

Since the transaction coordinator is at the center assigning PIDs and managing transactions, the first thing a producer has to do is issue a FindCoordinatorRequest to any broker to discover the location of its coordinator.

coordinator_type: The type of coordinator to find (0 = group, 1 = transaction)

FindCoordinator Request (Version: 1) => coordinator_key coordinator_type 
  coordinator_key => STRING
  coordinator_type => INT8
FindCoordinator Response (Version: 1) => throttle_time_ms error_code error_message coordinator 
  throttle_time_ms => INT32
  error_code => INT16
  error_message => NULLABLE_STRING
  coordinator => node_id host port 
    node_id => INT32
    host => STRING
    port => INT32

https://kafka.apache.org/protocol.html#The_Messages_FindCoordinator

ianwsperber commented 5 years ago

Hey @tulios! FYI I'm planning to begin implementing this protocol today. LMK if you'd like this work PR'd into a specific branch or have any other guidance to offer. Thanks 😄

tulios commented 5 years ago

You can create one branch per issue; we can merge things faster this way. Just ping me if you need anything.

tulios commented 5 years ago

Implemented in #189