Hi

> exchangeProperty("systemConfig.isActive")

This is not simple language, but refers to a exchange property key with the
given name.
You need to use simple as predicate instead of exchangeProperty






On Mon, Oct 17, 2022 at 7:38 PM Reto Peter <reto.pe...@advanceit.ch> wrote:

> Hi
> I have a simple question about the Predicates
> I got a systemConfig object, which has 2 getters/setters.
> The systemConfig object is set as an exchange property.
>
> When I use a the simple function, that works!
> from("direct:testPredicates")
> .to("direct:getSystemConfig")
>        .choice()
> .when(simple("${exchangeProperty.systemConfig.isActive} == false ||
> ${exchangeProperty.systemConfig.isEnabled} == false"))
>        .log("System is active and System is enabled")
>               .otherwise()
>                     .log("System is not active or MLSSync is disabled")
>        .end();
>
> When I try to use Predicates, then I thought this should work like this:
> Before the route:
> Predicate isSystemActive =
> exchangeProperty("systemConfig.isActive").isEqualTo(true);
> Predicate isSystemEnabled =
> exchangeProperty("systemConfig.isEnabled").isEqualTo(false);
>
> Inside the route:
> from("direct:testPredicates")
> .to("direct:getSystemConfig")
>        .choice()
>               .when(and(isSystemActive, isSystemEnabled))
>                     .log("System is active and System is enabled")
>               .otherwise()
>                     .log("System is not active or MLSSync is disabled")
>        .end();
>
> I am using Camel 3.18.2
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to