kafka-node: Error handling on connection

Hi

I noticed a recent issue #103, which I think attempted to resolve this issue. When kafka is not available, or the host provided to kafka.client is wrong, how can I detect this? The error handlers in this example are never hit… The example below creates a topic; it will not time out, and no error is reported; it simply repeats the process of trying to create a topic. If kafka fails for whatever reason we cannot recover on the application side, the application will never know.

var kafka = require('kafka-node'),
    Producer = kafka.Producer,
    client = new kafka.Client('wrong'),
    producer = new Producer(client);

    client.on('error', function (err) {
        console.log(err);
    });

    producer.on('error', function (err) {
        console.log(err);
    });

    producer.createTopics(['some-topic'], true, function (err, data) {
      console.log(data);
    });

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 2
  • Comments: 30 (3 by maintainers)

Most upvoted comments

lol, 3 years and counting… I hear RabbitMQ is pretty good…