In several enterprise integration scenarios, a single message event will trigger a sequence of processing steps, with each one performing a specific process or action. For example, assume a new customer order arrives in our enterprise in the form of a message. To process this message, we may need to implement several requirements:
All messages will be encrypted
Ensure that orders are placed only by trusted customers, each message will contain authentication information in the form of a digital certificate
Eliminate duplicate messages before subsequent order processing steps are initiated.
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:
<route> <from uri="activemq:order"/> <to uri="bean:encrypt"/> <to uri="bean:authenticate"/> <to uri="bean:duplicates"/> <to uri="activemq:invoice"/> </route>