← Lessons

quiz vs the machine

Gold1380

System Design

The Message Router

A component that forwards messages to the right destination.

4 min read · core · beat Gold to climb

What it is

A message router consumes from one channel and forwards each message, unchanged, to one of several output channels based on a decision. It centralizes routing logic so producers stay simple.

How it works

  • The router reads a message from its input channel.
  • It applies rules to pick a destination channel.
  • It sends the message there without changing its content.

Why it matters

  • Decouples the sender from the decision of where work goes.
  • Keeps routing logic in one place, easy to change and test.
  • Lets you reroute traffic without touching producers or consumers.

A router differs from a translator: it never alters the message, only its path. Common variants include the content based router and routers keyed off message headers. A risk is that the router becomes a bottleneck or a single point of failure, so it is often replicated. Because it holds the rules, all parties depend on it staying correct.

Key idea

A message router forwards each message unchanged to a chosen destination, centralizing routing decisions away from producers.

Check yourself

Answer to earn rating on the learn ladder.

1. What does a message router do to the message content?

2. What is a key benefit of centralizing routing in a router?