Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.22.2
-
None
-
Unknown
Description
When WsEndPoint reconnect-method fails in line 172 to create connection it throws an exception which is logged but it should also be given to exception handler.
This kind of situation happens when server is shut down while connection is open. First client tries to reconnect but when reconnect fails, client stops trying.
I'm trying to implement a feature which tries continuously to reconnect to server when the server is down. Connection state (open, disconnected or trying to connect) should also be indicated.
If exception is passed to exception handler then it would be possible to register exception handler outside Camel. The purpose of this exception handler is to shut down Camel context and recreate it again in order to reconnect. With this kind of setup I can continuously try to reconnect and also figure out the current connection state.
@Override public void onClose(WebSocket websocket, int code, String reason) { LOG.debug("websocket closed - reconnecting"); try { reConnect(); } catch (Exception e) { LOG.warn("Error re-connecting to websocket", e); } }