You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2015/02/02 19:48:34 UTC

[jira] [Updated] (CAMEL-8074) Aggregator doesn't honour policies for messages completed on a different thread

     [ https://issues.apache.org/jira/browse/CAMEL-8074?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-8074:
-------------------------------
    Issue Type: Wish  (was: Bug)

> Aggregator doesn't honour policies for messages completed on a different thread
> -------------------------------------------------------------------------------
>
>                 Key: CAMEL-8074
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8074
>             Project: Camel
>          Issue Type: Wish
>          Components: camel-core
>    Affects Versions: 2.14.0
>            Reporter: Marc Carter
>
> The following Java EIP looks textbook but the post-aggregation route is _not_ transacted as it runs on a different thread. The (transaction) policy meant to wrap the route doesn't get re-applied to the output.
> {code:java}
> from("direct:in")
>  .transacted("requiresTransaction")
>  .aggregate(simple("${header.symbol}"), new UseLatestAggregationStrategy())
>     .completionInterval(1000)
>   .bean(persistInDb)
>   .to("jms:output");
> {code}
> Since one cannot re-specify the transacted policy on the same route, the only workaround is to break it in two.
> {code:java}
> from("direct:in")
>  .transacted("requiresTransaction")
>  .aggregate(simple("${header.symbol}"), new UseLatestAggregationStrategy())
>     .completionInterval(1000)
>   .to("direct:x");
> from("direct:x")
>   .transacted("requiresTransaction")
>   .bean(persistInDb)
>   .to("jms:output");
> {code}
> Proposal is to ensure the route's transaction Policies is re-applied inside of the AggregateProcessor#onSubmitCompletion runnable if (and only if!) the current thread is not the one which started the route (which may be better inferred through {{exchange.getUnitOfWork}} - just a guess). 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)