camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jostein Gogstad (JIRA)" <>
Subject [jira] [Created] (CAMEL-8675) Aggregators swallows exceptions
Date Mon, 20 Apr 2015 10:57:58 GMT
Jostein Gogstad created CAMEL-8675:

             Summary: Aggregators swallows exceptions
                 Key: CAMEL-8675
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.12.2
            Reporter: Jostein Gogstad

Processors attached to aggregators can not throw exceptions, they will be swallowed. This
makes it impossible to propagate exceptions from camel to, for instance, a CXF endpoint or
custom JAX-WS service.

This route and test illustrates the problem:

public class AggregatorBug extends RouteBuilder {

    public void configure() throws Exception {
            .aggregationStrategy(new GroupedExchangeAggregationStrategy())
            .process(new Processor() {
                public void process(Exchange exchange) throws Exception {
                    throw new RuntimeException();

public class AggregatorBugTest extends CamelTestSupport {

    @EndpointInject(uri = "mock:beforeException")
    protected MockEndpoint beforeException;

    public boolean isUseAdviceWith() {
        return true;

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new AggregatorBug();

    protected void doPostSetup() throws Exception {
new AdviceWithRouteBuilder() {
            public void configure() throws Exception {

    public void exceptions_are_swallowed() throws Exception {
        try {
            template.sendBodyAndHeader("direct:start", 42, "cheese", "foo");
            fail("Expected exception");
        } catch (CamelExecutionException e) {


>From what I can see, the problem is located in [AggregatorProcessor|]
(github link). The output from {{doAggregate}} is ignored, even though it contains the exchange
with the exception. The exchanged that is used from here on out is the original input to the
route, not the aggregated output. 

The only way I can see that would trigger the exception would be to add a custom errorHandler
that re-throwed the exception. Unfortunately this is also impossible. The {{errorHandler}}
on {{AggregatorProcessor}} is set in the constructor, and there is no API to set the errorHandler
from {{AggregatorDefinition}}. The errorHandler set on the route is also ignored by {{AggregatorProcessor}}.

This problem has been reported earlier in CAMEL-1546. The proposed solution with using a seda
route is not satisfactory for cxf endpoints since the calling thread would return.

This message was sent by Atlassian JIRA

View raw message