...
To meet these requirements, we need to transform a stream of possibly duplicated, encrypted messages containing extra authentication data into a stream of unique, simple plain-text order messages without the extraneous data fields.
...
We can employ this integration pattern to sub-divide a larger complex process into a sequential series of smaller (and reusable) independent tasks or Filters. The sequence and flow of these filters is controlled by a set of channels (or Pipes).
Each of these filters follows a similar pattern of events: receives a message on the incoming pipe, processes the message, and then transmits the updated resulting message on the outgoing pipe. The pipe connects one filter to the next, sending output messages from one filter to the next.
Pipes and Filter using XML DSL:
Code Block | ||
---|---|---|
| ||
<route>
<from uri="activemq:order"/>
<to uri="bean:encrypt"/>
<to uri="bean:authenticate"/>
<to uri="bean:duplicates"/>
<to uri="activemq:invoice"/>
</route> |
Pipeline for the InOut Exchange Pattern
Normally, all of the endpoints in a pipeline have an input (In message) and an output (Out message), which implies that they are compatible with the InOut message exchange pattern. The pipeline connects the output of each endpoint to the input of the next endpoint. The Out message from the final endpoint is sent back to the original caller. You can define a route for this pipeline, as follows:
Code Block |
---|
<camelContext id="buildPipeline" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="jms:RawOrders"/>
<to uri="cxf:bean:decrypt"/>
<to uri="cxf:bean:authenticate"/>
<to uri="cxf:bean:deDup"/>
<to uri="jms:CleanOrders"/>
</route>
</camelContext> |
NOTE: There is no dedicated pipeline element in XML DSL format, thus the preceding combination of from
and to
elements is semantically equivalent to a pipeline.
Pipeline for the InOnly and RobustOnly Exchange Patterns
When there are no Out messages available from the endpoints in the pipeline (ie. the case of the InOnly
and RobustInOnly
exchange patterns), our pipeline cannot be constructed in the normal way. In this case, the pipeline is built by passing a copy of the original In message to each of the endpoints in the pipeline.