[
https://issues.apache.org/jira/browse/CAMEL-9741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15212443#comment-15212443
]
Tomas Rohovsky edited comment on CAMEL-9741 at 3/29/16 8:51 AM:
----------------------------------------------------------------
I couldn't open your archive, as Claus suggests zip would be better.
I suppose that you aggregates to/returns newExchange in your
AggregationStrategy. This means that the exchange which you returns from
recipientLIst is the exchange retrieved form the last endpoint in
recipientList, which is "bean:throwingExceptionConsumerB" in your second
example (analogically, if you aggregated to/returned the oldExchange, then the
exchange from the first ednpoint would be returned). And because the exchange
from the last endpoint has an exception set, it is thrown.
If you want to suppress the exception, you can do the following at the
beginning of the aggregate method:
{code}
Exception exception = newExchange.getException();
if (exception != null) {
return oldExchange;
}
{code}
however, I rather suggest proper handling of the exception by [an error
handler|http://camel.apache.org/error-handler.html].
was (Author: trohovsky):
I couldn't open your archive, as Claus suggests zip would be better.
I suppose that you aggregates to/returns newExchange in your
AggregationStrategy. This means that the exchange which you returns from
recipientLIst is the exchange retrieved form the last endpoint in
recipientList, which is "bean:throwingExceptionConsumerB" in your second
example (analogically, if you aggregated to/returned the oldExchange, then the
exchange from the first ednpoint would be returned). And because the exchange
from the last endpoint has an exception set, it is thrown.
If you want to suppress the exception, you can do the following before
returning an exchange form the aggregation strategy:
{code}
Exception exception = newExchange.getException();
if (exception != null) {
newExchange.setException(null);
}
{code}
however, I rather suggest proper handling of the exception by [an error
handler|http://camel.apache.org/error-handler.html].
> recipientList stop if the second endpoint throw exception
> ---------------------------------------------------------
>
> Key: CAMEL-9741
> URL: https://issues.apache.org/jira/browse/CAMEL-9741
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.16.2
> Reporter: courtin
> Assignee: Tomas Rohovsky
> Fix For: 2.16.3, 2.18.0, 2.17.1
>
> Attachments: recipientList.rar
>
>
> this code is ok and do the agregate :
> from("direct:rlAggregate")
> .process(new Processor() { String destinations =
> "bean:throwingExceptionConsumerB, bean:consumerC";} })
> .recipientList(header("destinations"),
> ",").parallelProcessing().aggregationStrategy(agg);
> an this one not :
> from("direct:rlAggregate")
> .process(new Processor() { String destinations =
> "bean:consumerC, bean:throwingExceptionConsumerB";} })
> .recipientList(header("destinations"),
> ",").parallelProcessing().aggregationStrategy(agg);
> it's throwing :
> org.apache.camel.CamelExecutionException: Exception occurred during execution
> on the exchange
> they should have the same results. And only the option stopOnException should
> allow to stop when an Exception rise.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)