beluchin
beluchin

Reputation: 12682

how to reference a flow variable in an expression filter?

How to reference a flow variable in an expression filter?

Assuming that myVariable is a boolean, I tried:

<expression-filter evaluator="variable" expression="myVariable" />

but that did not work. Eventually I settled for:

<expression-filter evaluator="groovy" expression="message.getInvocationProperty('myVariable')" />

Thanks

Upvotes: 0

Views: 2550

Answers (1)

David Dossot
David Dossot

Reputation: 33413

The variable expression is not complete and can't be evaluated to a boolean as is (while the Groovy probably can because the variable is a boolean).

See: http://www.mulesoft.org/documentation/display/MULE3USER/Using+Expressions#UsingExpressions-UsingExpressionFilters

You need to specify an expected value :

<expression-filter evaluator="variable" expression="myVariable=true" />

The following should work too:

<expression-filter evaluator="header" expression="INVOCATION:myVariable=true" />

Upvotes: 1

Related Questions