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

Reply via email to