Use a stateful filter, an Aggregator, to collect and store individual messages until a complete set of related messages has been received. Then, the Aggregator publishes a single message distilled from the individual messages.
Use a Content-Based Router to route each message to the correct recipient based on message content.
Composed Message Processor
Use Composed Message Processor to process a composite message. The Composed Message Processor splits the message up, routes the sub-messages to the appropriate destinations and re-aggregates the responses back into a single message.
Use a Dynamic Router, a Router that can self-configure based on special configuration messages from participating destinations.
Use a central Message Broker that can receive messages from multiple destinations, determine the correct destination and route the message to the correct channel. Implement the internals of the Message Broker using the design patterns presented in this chapter.
Use a special kind of Message Router, a Message Filter, to eliminate undesired messages from a channel based on a set of criteria.
Insert a special filter, a Message Router, which consumes a Message from one Message Channel and republishes it to a different Message Channel channel depending on a set of conditions.
Pipes and Filters
Use the Pipes and Filters architectural style to divide a larger processing task into a sequence of smaller, independent processing steps (Filters) that are connected by channels (Pipes).
Use a central processing unit, a Process Manager, to maintain the state of the sequence and determine the next processing step based on intermediate results.
Define a channel for each recipient. Then use a Recipient List to inspect an incoming message, determine the list of desired recipients, and forward the message to all channels associated with the recipients in the list.
Use a stateful filter, a Resequencer, to collect and re-order messages so that they can be published to the output channel in a specified order.
Attach a Routing Slip to each message, specifying the sequence of processing steps. Wrap each component with a special message router that reads the Routing Slip and routes the message to the next component in the list.
Use a Scatter-Gather that broadcasts a message to multiple recipients and re-aggregates the responses back into a single message.
Use a Splitter to break out the composite message into a series of individual messages, each containing data related to one item.