Hi

There is no support for elvis or ternary operators.
You can use camel-groovy and groovy language for such kind

The docs on the website has the details what is supported
https://camel.apache.org/components/latest/languages/simple-language.html



On Thu, Oct 15, 2020 at 2:24 PM nomit babraa <h.bab...@sheffield.ac.uk> wrote:
>
> Hi
>
> Using the ternary operator logic as described here
> http://www.davsclaus.com/2011/09/camel-29-much-improved-simple-language.html
>
> I am trying to set a exchange property like so where
> exchangeProperty.StatusMsg = 'abc'
>
> .setProperty("StatusMsg2")
> .simple("${exchangeProperty.StatusMsg} == null ? 'ee2e2e2' : 'fffffff'")
>
> That sets StatusMsg2 to the the string
>
> abc == null ? 'ee2e2e2' : 'fffffff'
>
> as the value, rather than evaluating the expression.
>
> I am using camel 2.29 and have checked my spaces are correct
>
> if I replace with
>
> .simple("true ? 'ee2e2e2' : 'fffffff'")
>
> I get the string
>
> true ? 'ee2e2e2' : 'fffffff'
>
> If I do
>
> simple(true ? "ee2e2e2" : "fffffff")
>
> I then get the string
>
> ee2e2e2
>
> If I try
>
> .simple("${exchangeProperty.StatusMsg} == null" ? "ee2e2e2" : "fffffff")
>
> I get a "Type mismatch: cannot convert from String to boolean" compilation 
> error
>
> How do I get the first part of my ternary expression to be recognised
> as an expression itself?
>
> Thanks for any advice
>
>
> n



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

Reply via email to