...
The following operators is supported:
Operator | Description |
---|---|
== | equals |
> | greather than |
>= | greather than or equals |
< | less than |
<= |
...
less than or equals | |
!= | not equals |
contains | For testing if contains in a string based value |
regex | For matching against a given regular expression pattern defined as a String value |
in | For matching if in a set of values, each element must be separated by comma. |
...
Some examples:
Code Block |
---|
simple("${in.header.foo} == 'foo'") // ' ' can be omitted simple("${in.header.foo} == foo") // here Camel will type convert '100' into the type of in.header.bar and if its an Integer '100' will also be converter to an Integer simple("${in.header.bar} == '100'") simple("${in.header.bar} == 100") // 100 will be converter to the type of in.header.bar so we can do > comparison simple("${in.header.bar} > 100") // testing for not null simple("${in.header.baz} != null") |
...
Code Block |
---|
simple("${in.header.date} == ${date:now:yyyyMMdd}")
simple("${in.header.type} == ${bean:orderService?method=getOrderType}")
|
And an example with contains, testing if the title contains the word Camel
Code Block |
---|
simple(${in.header.title} contains 'Camel'")
|
And an example with regex, testing if the number header is a 4 digit value:
Code Block |
---|
simple(${in.header.number} regex '\d{4}'") |
And finally an example if the header equals any of the values in the list. Each element must be separated by comma, and no space around.
This also works for numbers etc, as Camel will convert each element into the type of the left hand side.
Code Block |
---|
simple(${in.header.type} in 'gold,silver'")
|
Tip | |||||||
---|---|---|---|---|---|---|---|
| |||||||
As the Spring XML does not have all the power as the Java DSL with all its various builder methods, you had to resort to use some other languages
|
...