SOHU-Co/kafka-node

Kafka Broker Nodejs connection check

khvr opened this issue · 0 comments

khvr commented

How to test if my Nodejs App is connected to my Kafka broker and send a message to an endpoint?

  • I tried to use the on ready and on error methods to do it, but after some point, the broker and app stops communicating
  • Is there a better way to do it? or what changes I can try to rectify the problem?

To replicate

  • Run kafka and zookeeper
  • Instantiate the Kafka-node library and create a client
  • create an endpoint say testing-Kafka on which have a switching logic to return success if client.on(ready) is executed and a failed message if client.on(err) method is executed.
  • The code will work for few minutes like 5 minutes after which the endpoint will not respond