Jukka Aalto created CAMEL-12951:
-----------------------------------

             Summary: Camel-AHC-WS: reconnect exception is not passed to 
exception handler
                 Key: CAMEL-12951
                 URL: https://issues.apache.org/jira/browse/CAMEL-12951
             Project: Camel
          Issue Type: Bug
          Components: camel-ahc-ws
    Affects Versions: 2.22.2
            Reporter: Jukka Aalto


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.

 

[https://github.com/apache/camel/blob/master/components/camel-ahc-ws/src/main/java/org/apache/camel/component/ahc/ws/WsEndpoint.java]

 
{code:java}
@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);
   }
}
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to