# Message Routing

**In short:** Message routing patterns decide where each message goes, so a sender does not need to know the final recipient. Examples are the Content-Based Router, Recipient List, Aggregator, Scatter-Gather and Routing Slip.

## 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

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

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

A router sends each message to a system based on its content, so the sender knows no addresses.

```mermaid
flowchart LR
  S[Sender] --> R{Router}
  R -->|books| A[System A]
  R -->|electronics| B[System B]
```

## 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

- [Content-based Router](https://arc.fuet.ch/concepts/integration/content-based-router.md)
- [Recipient List](https://arc.fuet.ch/concepts/integration/recipient-list.md)
- [Scatter/Gather](https://arc.fuet.ch/concepts/integration/scatter-gather.md)
- [Routing Slip](https://arc.fuet.ch/concepts/integration/routing-slip.md)
- [Message Filter](https://arc.fuet.ch/concepts/integration/message-filter.md)
- [Dynamic Router](https://arc.fuet.ch/concepts/integration/dynamic-router.md)
- [Process Manager](https://arc.fuet.ch/concepts/integration/process-manager.md)
- [Composed Message Processor](https://arc.fuet.ch/concepts/integration/composite-message-processor.md)

## Sources

- [Introduction to Message Routing - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageRoutingIntro.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
- [Content-Based Router - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/ContentBasedRouter.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
- [Recipient List - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/RecipientList.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
- [Scatter-Gather - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/BroadcastAggregate.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
- [Routing Slip - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/RoutingTable.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
- [Aggregator - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/Aggregator.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
