0

I am using Camel 2.17.0. I have a need to use in operator in the simple language in the blueprint.xml file as the following

<choice id="_choice3"> <when id="_when3"> <simple>${header.STATUS} in 'Draft,Review'</simple> ......

However, It doesn't work and throws following exception:

org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-A5668784-61983-1579873128661-9-6] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1706) at org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:104) at org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:83)

By the way, I have been using choice/when condition for a long time. Then I tried to use || and or operator as followings:

<simple>(${header.STATUS.contains("Draft")} or ${header.STATUS.contains("Review")})</simple>
<simple>(${header.STATUS} contains 'Draft' || ${header.STATUS} contains 'Review')</simple>
<simple>(${header.STATUS} contains 'Draft' or ${header.STATUS} contains 'Review')</simple>

In all cases, it throws the same exception. Please help. Thanks in advance

Chris W
  • 21
  • 1
  • 9
  • [This question](https://stackoverflow.com/questions/41172194/camel-route-multiple-if-condition) gets you closest but requires that you do this in Java. Can you not leverage the Java DSL for this? – Makoto Jan 24 '20 at 16:49
  • We have been using xml DSL for over two years. We are not planned to use Java – Chris W Jan 24 '20 at 17:32

1 Answers1

0

you might lose those extra "()" (brackets) at the end. Could you try something like this

<simple>${header.STATUS} contains'Draft' or ${header.STATUS} contains 'Review'</simple>

I pre-assume that you are setting the Draft (String) value in the Header.

I hope it helps. :)

Clover
  • 507
  • 7
  • 22
  • Thank you very much for the response. Yes, I set the Draft (String) value in the Header. I decided to follow an alternative approach by moving the or logic to a processor. It is good for my case. – Chris W Jan 28 '20 at 17:38