After various attempts, I managed to implement a workaround for the problem
by adding a try/catch/finally - it turns out the the finally clause is
executed.
I encountered a further issue with the finally clause, as only the first
processor was invoked. After a bit of debug, I found that the
PipelineHelper.continueProcessing was returning fals because of
Exchange.ERRORHANDLER_HANDLED being set - removing the property did the
work.
The code doesn't look to good, but works... If there is a more elegant to
implement this, I would be grateful to know :-)
@Override
public void configure() throws Exception {
from("direct:start").routeId("startRoute")
.setHeader("SplitArray", constant(new String [] {
"split1",
"split2"}))
.split(header("SplitArray"), new
AggregationStrategy(){@Override
public Exchange aggregate(Exchange oldExchange,Exchange newExchange) {
return null; }})
.doTry()
//.throwException(new Exception("test"))
.inOut("direct:processItem")
.doCatch(Exception.class)
.log("Exception")
.doFinally()
.removeProperty(Exchange.ERRORHANDLER_HANDLED)
.log("${body}")
.log("${body} secondtime")
.end()
.end()
.log("split end");
from("direct:processItem")
.errorHandler(defaultErrorHandler()).onException(Exception.class).handled(true).end()
.throwException(new Exception("error!"))
//.log("OK")
;
}
--
View this message in context:
http://camel.465427.n5.nabble.com/Split-with-Aggregation-when-throw-Exception-issue-tp5750159p5761176.html
Sent from the Camel - Users mailing list archive at Nabble.com.