Message Routing



Content-Based Router

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.

Dynamic Router

Use a Dynamic Router, a Router that can self-configure based on special configuration messages from participating destinations.

Message Broker

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.

Message Filter

Use a special kind of Message Router, a Message Filter, to eliminate undesired messages from a channel based on a set of criteria.

Message Router

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).

Process Manager

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.

Recipient List

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.

Routing Slip

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.