You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "michael elbaz (JIRA)" <ji...@apache.org> on 2018/10/28 18:05:00 UTC

[jira] [Created] (CAMEL-12906) Strange comportement with aggregator

michael elbaz created CAMEL-12906:
-------------------------------------

             Summary: Strange comportement with aggregator
                 Key: CAMEL-12906
                 URL: https://issues.apache.org/jira/browse/CAMEL-12906
             Project: Camel
          Issue Type: Bug
          Components: camel-activemq
    Affects Versions: 2.22.1
            Reporter: michael elbaz


/!\ Its about camel aggregator and error handling

My case is about graceful shutdown and error handling in case of aggregator first one:

In this example i will get **RejectedExecutionException** when during the shutdown and the exception is not catched by the **onexception** method
{code:java}
@Component
public class AmqRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        errors();

        from("timer:foo?period=1000")
                .log("1")
                .transform().body(() -> "DATA " + RandomStringUtils.randomAlphanumeric(10))
                .convertBodyTo(String.class)
                .to(amq());

        from(amq()).to("direct:foo");

        from("direct:foo")
                .delay(3000)
                .aggregate(constant(true), new GroupedBodyAggregationStrategy())
                .completionSize(10)
                .forceCompletionOnStop()
                .log("${body}");
    }

    public void errors() {
        onException(Exception.class)
                .useOriginalMessage()
                .to("activemq:recovery")
                .handled(true)
                .onRedelivery(exchange -> System.err.println("push to amq"));

        errorHandler(deadLetterChannel("log:dead?level=ERROR"));
    }

    private static String amq() {
        String amq = "activemq:data";

        amq += "?transacted=true";

        return amq;
    }

}
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)