You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Joe San <co...@gmail.com> on 2016/02/15 16:28:17 UTC

Kafka Zookeeper Connection Error Listener

I have a Kafka broker and Zookeeper running locally. I use the high level
consumer API to read messages from a topic. Now I manually disconnect /
shutdown the Zookeeper instance running on my local machine.

I can see in my consumer logs the following:

20160215-16:03:43.110+0100
[kafka-consumer-akka.actor.default-dispatcher-4-SendThread(127.0.0.1:2181)]
WARN  org.apache.zookeeper.ClientCnxn - Session 0x152e4506a8f0005 for
server null, unexpected error, closing socket connection and attempting
reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_60]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
~[na:1.8.0_60]
at
org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
~[zookeeper-3.4.6.jar:3.4.6-1569965]

It is trying to re-connect, is there a way that I could in my consumer
application hook into this exception? I do not see any methods exposed by
the ConsumerConnector API that would let me know the connection status to
Zookeeper. Any ideas as to from where could I get this information about
Zookeeper connection status in my consumer application?