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 2023/07/16 11:51:00 UTC
[jira] [Commented] (CAMEL-19343) Predicates are shared between templated routes
[ https://issues.apache.org/jira/browse/CAMEL-19343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17743516#comment-17743516 ]
Claus Ibsen commented on CAMEL-19343:
-------------------------------------
This is because you use the fluent builder on simple. If you do this
.when(simple("'{{" + CHOICE_PARAMETER + "}}' == 'some'")
Then it works fine and this is also the way other DSLs and Kamelets are doing this.
> 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
> Assignee: Claus Ibsen
> 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)