You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sminten <ma...@stefanminten.net> on 2015/06/24 10:07:05 UTC

Camel+Netty does not retry connection on ConnectException

I have 2 Camel routes:

from("jms:queue:" + queue + "?transacted=true")
        .bean(interfaceProcessor, "prepareMessage")
        .to("direct:interfaceRoute")
        .end();

from("direct:interfaceRoute")
        .errorHandler(noErrorHandler())
        .setExchangePattern(ExchangePattern.OutIn)
        .to("netty:tcp://" + address + ":" + port +
"?clientMode=true&requestTimeout=" + requestTimeout + "disconnect=true")
        .bean(interfaceProcessor, "doStuff");

The first route is triggered when a message is put on a JMS queue. The
message is then processed in a bean and the return value is put on a
separate route to send it to a remote host.

When something goes into the direct:interfaceRoute, Netty is supposed to
open a new connection to a certain address/port as a client. This works
fine, but when the remote host is not available I get a ConnectException and
stops operating altogether. If this happens, it needs to keep retrying until
the remote host is available.

I tried making the 'upper' route transacted and I removed any error handler
on the route that does the actual sending on a socket. This works for a
ReadTimeoutException (the remote host does not respond in time). When this
happens, the message is resent until the remote host responds. I need the
same handling for a ConnectException.

How can I achieve this?



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Netty-does-not-retry-connection-on-ConnectException-tp5768527.html
Sent from the Camel - Users mailing list archive at Nabble.com.