问题
I want to filter out payload if it contains following error codes 202048 202049 200003
filter --expression=payload.contains('202048')||payload.contains('202049')||payload.contains('200003')
Can i put or condition in my expression || is my or
回答1:
See the SpEL language reference.
Use OR
(or or
).
You need spaces around the or
so you need to quote the whole expression; since the module is likely within a string, you will need to escape the literal quotes. For example:
xd:>stream create foo --definition "time |
filter --expression='payload.endsWith(\"0\") OR payload.endsWith(\"1\")'| log" --deploy
来源:https://stackoverflow.com/questions/34088075/filtering-on-multiple-conditions-spring-xd