Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to verify connection / debug connection problems? #620

Open
codeofsumit opened this issue Feb 28, 2017 · 5 comments
Open

how to verify connection / debug connection problems? #620

codeofsumit opened this issue Feb 28, 2017 · 5 comments

Comments

@codeofsumit
Copy link

How can I debug connection problems?

This is my code but there is no console output at all. I'm sure the connection did not establish but I'd like some debug information.

const Kafka = require('kafka-node');
const Consumer = Kafka.Consumer;
const client = new Kafka.Client('localhost:3001', 'kafka-node-client');
const consumer = new Consumer(client, [
  {
    topic : 'test'
  }
]);

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

consumer.on("ready", (err) => {
    console.log(err || "Connected to kafka");
});

consumer.on('error', function (err) {
    console.log('err: ' + err);
});
@hyperlink
Copy link
Collaborator

hyperlink commented Feb 28, 2017

Hi. Is the address you're passing into the client a zookeeper host?

Unfortunately, if the module can't connect to zookeeper the zookeeper client will just silently fail and keep retrying. #117

@codeofsumit
Copy link
Author

that's very unfortunate :-/

@hyperlink
Copy link
Collaborator

but in practice it's not a big issue. How often are you unsure of where your zookeeper host lives? If you're worried about failures you can also provide a list of zookeeper hosts and it will attempt to connect to any of them.

@ApoorvSaxena
Copy link

Possible to provide a timeout in the config which fails in case Zookeeper connection is not feasible till then?

@hyperlink
Copy link
Collaborator

It's simple to add a timeout around if ready was emitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants