[
https://issues.apache.org/jira/browse/CAMEL-13640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-13640.
---------------------------------
Resolution: Not A Problem
That is how its supposed to work, when you use handled(true) then the exception
is handled, and Camel stops continue routing.
If you want to keep going (like a try .. catch would do) then use
continued(true) instead, eg
from("direct:processItemOnException").routeId("processItemOnException").onException(Exception.class)
.continued(true).end().log("${body}").throwException(new Exception("an
Error!"));
> Camel Split with Aggregate, calling subroute with onException (handled =
> true) stops, doesn't work the same way as calling a sub route using doTry
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-13640
> URL: https://issues.apache.org/jira/browse/CAMEL-13640
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.24.0
> Reporter: George Daswani
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: Future
>
> Attachments: BugReport.zip
>
>
> Split with Aggregate calling a sub route that has handled exception (eq.
> direct:exceptionStart) doesn't behave the same as one calling a sub route
> swallowing exceptions using doTry (eq. direct:doTryStart)
> The two should be functionally equivalent but the one calling the sub route
> with onException stops prematurely. It never gets to ".log("done with split
> and aggregate").
> Others have reported the same thing on the camel-users list - [for
> example|http://camel.465427.n5.nabble.com/Split-with-Aggregation-when-throw-Exception-issue-td5750159.html]
> Sample program attached (maven project) - BugReport.zip
>
> {code:java}
> public void configure() throws Exception {
> from("direct:exceptionStart").routeId("exceptionStart").split(body(), new
> MyAggregationStrategy())
> .to("direct:processItemOnException").end().log("done with split and
> aggregate");
> from("direct:processItemOnException").routeId("processItemOnException").onException(Exception.class)
> .handled(true).end().log("${body}").throwException(new Exception("an
> Error!"));
> from("direct:doTryStart").routeId("doTryStart").split(body(), new
> MyAggregationStrategy())
> .to("direct:processItemOnDoTry").end().log("done with split and aggregate");
> from("direct:processItemOnDoTry").routeId("processItemOnDoTry").doTry().log("${body}")
> .throwException(new Exception("an
> Error!")).endDoTry().doCatch(Exception.class)
> .log("swallowed exception");
> }{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)