Apache Camel route end when using try catch

apache-camel

Solution

Just add `stop()` in the end of the `doCatch()` block:

.doCatch(Exception.class)
    .to("direct:hourlyFeedParts")
    .stop()
.end()

Problem

I have a route which has a "to" clause. I have used a try catch block to redirect the exchange to the route if some exception takes place. The exception I had was related to max no of parallel connections allowed with the client. Seems, when the exception is resolved, every retry of the exchange was processed further where it was left. How shall I be able to end the route which had exception. Following is my code. ``` from("direct:hourlyFeedParts") .routeId("appnexus hourly downloader") .doTry() .process(AppNexusProcessor.getDownloadProcessor()) .process(AppNexusProcessor.getNamingProcessor()) .id("Appnexus Feed Downloader") .log("Downloading file ${file:name}") .to("{{appnexus.partsDestination}}") .log("Downloaded file ${file:name} to local") .doCatch(Exception.class) .to("direct:hourlyFeedParts") .end() .bean(AppNexusProcessor.class, "updateIdempotentList") .choice() .when(simple("${property.CamelSplitComplete} == true")) .split(beanExpression(AppNexusProcessor.class, "getAggregatorProcessor")) .to("direct:S3PreProcessor") .endChoice() .end(); ``` I was thinking may be using endParent() after ``` .doCatch(Exception.class) .to("direct:hourlyFeedParts") .endParent() ``` Is this the right approach. I couldn't understand the exact use of endParent() from the documentation.

Original source