[
https://issues.apache.org/jira/browse/CAMEL-27023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Federico Mariani updated CAMEL-27023:
-------------------------------------
Fix Version/s: 4.24.0
> camel-core - route templates: an aggregate completionSize, completionTimeout
> or completionPredicate, or an onException handled or retryWhile, given as an
> expression is shared by every route created from the template
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27023
> URL: https://issues.apache.org/jira/browse/CAMEL-27023
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Reporter: Federico Mariani
> Assignee: Federico Mariani
> Priority: Minor
> Fix For: 4.24.0
>
>
> In the Java DSL, the options of an EIP that are kept as an expression
> sub-element ({{completionSize}}, {{completionTimeout}} and
> {{completionPredicate}} of the Aggregate EIP, {{handled}}, {{continued}} and
> {{retryWhile}} of {{onException}}) wrap the expression builder they are
> given. Every route created from a route template copies that wrapper, not the
> expression in it, so all of them share one expression. It is created with the
> template parameters of the first route, and the other routes use the same
> value.
> {code:java}
> routeTemplate("t").templateParameter("name").templateParameter("size")
> .from("direct:{{name}}")
> .aggregate(constant(true), new GroupedBodyAggregationStrategy())
> .completionSize(simple("{{size}}"))
> .to("mock:{{name}}");
> templatedRoute("t").routeId("a").parameter("name", "a").parameter("size",
> "2");
> templatedRoute("t").routeId("b").parameter("name", "b").parameter("size",
> "3");
> // 6 messages to direct:b give 3 groups of 2 on mock:b, not 2 groups of 3
> {code}
> These behave the same:
> {code:java}
> .completionPredicate(simple("${exchangeProperty.CamelAggregatedSize} ==
> {{size}}"))
> .completionTimeout(simple("{{timeout}}"))
> .onException(IllegalStateException.class).retryWhile(simple("${header.CamelRedeliveryCounter}
> < {{retries}}"))
> {code}
> The String option ({{completionSize("...")}}) works.
> Expected: each route created from the template uses its own template
> parameters, as the EIPs that take an expression directly (filter, setBody,
> choice/when ...) already do. The route template documentation says a literal
> simple expression can be used in a template.
> _Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)