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

Bartosz Popiela updated CAMEL-19343:
------------------------------------
    Description: 
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 the unit test. It fails for the second instance of the template.

  was:
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 the unit test. It fails for the route that is instantiated as the second 
one.


> Predicates are shared between templated routes
> ----------------------------------------------
>
>                 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
>            Priority: Major
>
> 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 the unit test. It fails for the second instance of the template.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to