Message Routing
Explanation
Section titled “Explanation”Message routing is a family of patterns that decouple a message source from the message’s final destination (f1). The sender hands over a message. The routing logic decides who receives it.
Content-Based Router. It sends each message to the right recipient based on what the message contains. This helps when one logical function is spread over several systems (f2). See the article Content-based Router.
Recipient List. It computes a list of recipients. Then it sends a copy of the message to each one (f3). Like the Content-Based Router, it normally leaves the message contents unchanged (f4). See the article Recipient List.
Aggregator. It collects several messages into one. An Aggregator that waits for all replies has a weakness: one missing or delayed message can block the whole result (f7). A time-out strategy avoids this. The Aggregator waits a set time, then decides with what has arrived (f8).
Scatter-Gather. It uses an Aggregator to collect the responses into a single response message (f5). See the article Scatter/Gather.
Routing Slip. It attaches the sequence of processing steps to each message (f9). See the article Routing Slip.
Example
Section titled “Example”An online shop receives orders. A router reads the product type in each order. It sends book orders to one system and electronics orders to another. The sender of the order knows neither system.
For a price check, the shop sends a copy of one request to three supplier systems. It then combines the answers into one reply. If one supplier is slow, the shop waits a set time and uses the answers it already has.
Trade-offs
Section titled “Trade-offs”The verified facts describe mainly the benefit: senders no longer need to know destinations (f1).
One cost shows up in the Aggregator. If it waits for every reply, a single missing message blocks the result (f7). Time-outs fix this, but the Aggregator then decides with incomplete answers (f8).
Diagram source
flowchart LR S[Sender] --> R{Router} R -->|books| A[System A] R -->|electronics| B[System B]Checks
Section titled “Checks”- Where a message must reach a different system depending on its content, a Content-Based Router is used instead of the sender choosing the target.
- Every Aggregator that waits for replies defines a time-out strategy, so one missing message cannot block processing.
- Where one message must go to several recipients, a Recipient List sends a copy to each.
Related
Section titled “Related”- Content-based Router
- Recipient List
- Scatter/Gather
- Routing Slip
- Message Filter
- Dynamic Router
- Process Manager
- Composed Message Processor
Sources
Section titled “Sources”- Introduction to Message Routing - Enterprise Integration Patterns — enterpriseintegrationpatterns.com, accessed 2026-11-09
- Content-Based Router - Enterprise Integration Patterns — enterpriseintegrationpatterns.com, accessed 2026-11-09
- Recipient List - Enterprise Integration Patterns — enterpriseintegrationpatterns.com, accessed 2026-11-09
- Scatter-Gather - Enterprise Integration Patterns — enterpriseintegrationpatterns.com, accessed 2026-11-09
- Routing Slip - Enterprise Integration Patterns — enterpriseintegrationpatterns.com, accessed 2026-11-09
- Aggregator - Enterprise Integration Patterns — enterpriseintegrationpatterns.com, accessed 2026-11-09