Streaming Exception - Connection timed out


#1

Hello,

I have developed a java application that implements v3.1.1 of the api.

The app has been streaming data successfully for a few weeks.

Today, I received the following exception and no more interactions have been received since:-

java.net.ConnectException: Connection timed out: no further information: websocket.datasift.com/46.236.5.226:443
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.7.0_51]
at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source) ~[na:1.7.0_51]
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:208) ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:287) ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:524) ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:464) ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378) ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350) ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [netty-all-4.0.20.Final.jar:4.0.20.Final]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_51]

Looking at your example code, it says “do something useful”:-

public static class ErrorHandler extends ErrorListener {
    public void exceptionCaught(Throwable t) {
        t.printStackTrace();
        //do something useful...
    }
}

If an exception is caught, what do you recommend? Should I always re subscribe to my stream(s)?

Regards

Russ


#2

As mentioned in the duplicate of this question at https://support.datasift.com/hc/communities/public/questions/202199138-Streaming-Exception-Connection-timed-out?locale=en-us, the Java client should handle all reconnections automatically; you shouldn't need to code for that within your application