camel系列-如何使用OutputExpressionNode

概念

OutputExpressionNode 包含一个表达式和一个执行器数组,其包含如下 eip

示例

Filter

  1. simple 是表达式条件判断
  2. to 是执行器
1
2
3
4
5
6
7
8
<route>
<from uri="direct:a"/>
<filter>
<simple>${header.foo} == 'bar'</simple>
<to uri="direct:bar"/>
</filter>
<to uri="direct:b"/>
</route>

Split

以下 simple 表达式是必要的,先使用一个表达式获取 exchange 的数据,这个是需要特别注意的点。因为按语义理解,是可以直接对 list 进行 split 的对象做操作的

1
2
3
4
5
6
7
8
<route>
<from uri="direct:a" />
<split>
<simple>${body}</simple>
<bean method="todo1" beanType="xxx"/>
<bean method="todo2" beanType="xxx"/>
</split>
</route>