[
https://issues.apache.org/jira/browse/CAMEL-19343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-19343.
---------------------------------
Resolution: Information Provided
I added a section to the docs about this limitation with simple fluent builder
style.
> Predicates are shared between templated routes in Java DSL with simple
> predicate builder
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-19343
> URL: https://issues.apache.org/jira/browse/CAMEL-19343
> Project: Camel
> Issue Type: Bug
> Components: camel-core-model
> Affects Versions: 3.20.4
> Reporter: Bartosz Popiela
> Assignee: Claus Ibsen
> Priority: Minor
>
> Templated routes with the "choice" processor share the same Predicate
> ({_}org.apache.camel.model.WhenDefinition#expression#predicate{_}) and
> because it is initialized with template parameters of the first route
> created, it fails for the other routes. This is particularly visible when
> using Kamelets.
> The proposed solution would be for _org.apache.camel.model.WhenDefinition_ to
> accept Supplier<Predicate> (or similar) instead of the Predicate instance but
> that would require static factory methods in
> _org.apache.camel.support.builder.PredicateBuilder_ to be refactored or a new
> class to be created.
> [This|https://github.com/bartoszpop/CAMEL-19343/blob/main/src/test/java/io/github/bartoszpop/camel/Camel19343Test.java]
> is a unit test. It fails for the second instance of the template.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)