Hi, I'm working with a kafka producer in async mode using zookeeper. >From time to time, i observe network problems and i see the following error in >my logs:
[2014-02-11 11:21:57,848][INFO ][org.apache.zookeeper.ClientCnxn] Unable to read additional data from server sessionid 0x1441cc4a9c5001f, likely server has closed socket, closing socket connection and attempting reconnect [2014-02-11 11:21:57,949][INFO ][org.I0Itec.zkclient.ZkClient] zookeeper state changed (Disconnected) [2014-02-11 11:21:59,143][INFO ][org.apache.zookeeper.ClientCnxn] Opening socket connection to server obfuscated . Will not attempt to authenticate using SASL (unknown error) [2014-02-11 11:21:59,146][WARN ][org.apache.zookeeper.ClientCnxn] Session 0x1441cc4a9c5001f for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068) The problem is, my code isn't catching this error and i haven't found anyway to do so. I thought about using the CallbackHandler but it doesn't have any onError method. Is there anyway to trigger some process when connection fails ? What i would like to do is to put my trafic on hold when this happens and until the connection is back up so i'm sure each incoming request that succeeds is logged into kafka. FYI, I'm not using the synchronized producer for performance issues. Thanks for your help on this matter. Laurent