Is there a specific exception you can catch when the connection fails?  If so, 
you could use onException to handle that case.


Something like the above should handle #1.

> On Oct 18, 2016, at 2:38 AM, Shabin5785 <> wrote:
> I have a route that calls an external rest service. I have configured my
> error handler as shown below.
> errorHandler(deadLetterChannel("jms:dlc").maximumRedeliveries(3));
> What i want to do:
> 1) If connection to external api fails, i want to retry 3 times and then
> send to deadLetterChannel
> 2) If api call is fine, i want to check the status code, log the response
> and then send the message to deadLetterChannel.
> For that i set throwExceptionOnFailure to false.
> In my route i have a bean as the last endpoint. This bean receives the
> response from the external end point and checks for the status.
> void process(Exchange exchange){
>  //check http status code
>  //if not success
>  exchange.setProperty(Exchange.ROUTE_STOP,true);
>  //sendToDeadLetterQueue;
>  }
> My problem is that redelivery happens even when i am able to connect to API.
> I expect the redelivery to happen on error. I am handling the response from
> API and also stopping the exchange. So i expect my Bean to log the response
> from API, send to deadLetterQueue(I have a route for that) and stop. But
> redelivery happens 3 times evand so en when API call is successful and so
> deadletterchannel route is invoked 3 times
> Can i stop the redelivery from my bean?
> --
> View this message in context: 
> Sent from the Camel - Users mailing list archive at

Reply via email to