Camel组件之PipesAndFilters

Camel supports the Pipes and Filters from the EIP patterns in various ways. With Camel you can split your processing across multiple independent Endpoint instances which can then be chained together.

PipesAndFilters就是用来提供”链式“处理流程的,比如”登录-验证-放行“等。

Pipes,指的就是Pipe Line,就是把一些操作连接起来,类似于管道操作。

看一个示例:

from("direct:a").pipeline("direct:x", "direct:y", "direct:z", "mock:result");

 direct:a发送Message,一次经过direct:x、direct:y、direct:z,然后达到mock:result。

String XML实现:

<route>
  <from uri="activemq:SomeQueue"/>
  <pipeline>
    <bean ref="foo"/>
    <bean ref="bar"/>
    <to uri="activemq:OutputQueue"/>
  </pipeline>
</route>

 其实相当于:

<route>
  <from uri="activemq:SomeQueue"/>
  <bean ref="foo"/>
  <bean ref="bar"/>
  <to uri="activemq:OutputQueue"/>
</route>
 

猜你喜欢

转载自salever.iteye.com/blog/1316896