SOHU-Co / kafka-node

Node.js client for Apache Kafka 0.8 and later.
MIT License
2.66k stars 627 forks source link

how to test if we have really connect to the server. for example var client = new kafka.Client('url:443'); does the connection test happens. #1169

Open vkodi opened 5 years ago

vkodi commented 5 years ago

Questions?

Bug Report

Environment

For specific cases also provide

Include Sample Code to reproduce behavior

// include code here

var kafka = require('kafka-node'); var HighLevelProducer = kafka.HighLevelProducer; var Producer = kafka.Producer; var conf='localhost1:2181'; var client = new kafka.Client(conf); var producer = new Producer(client); var msg = [ { topic: 'test', messages: 'test msg', partition: 0 } ]; producer.on('ready', function () { producer.send(msg, function (err) { if (err) { console.log(err); } }) });

Include output with Debug turned on

it works good on localhost, but when we give wrong url, we would like to catch the error and can you give us a sample producer connecting to Kafka using ssl with basic steps and with catching an error Thanks for your contribution!

hyperlink commented 5 years ago

The Client has been removed please use KafkaClient instead.