# Message Dispatcher

> Central dispatcher receives messages and hands them off to specific handlers — controlled fan-out to workers.

- **Category**: Integration
- **Subcategory**: Messaging Endpoints
- **Canonical URL**: https://designpattern.fyi/patterns/message_dispatcher/

---

## Description
Clean, reusable architecture pattern.


## Use Cases
Multi-priority job queue — Dispatcher receives job messages and routes HIGH priority jobs to a dedicated premium-workers pool, NORMAL jobs to general-workers pool. Premium workers are never waiting on normal jobs. Simple Competing Consumers on one queue would not give this control.





## Trade-offs


### Advantages

- Adds routing and prioritization logic to consumer distribution

- Central control point for handler lifecycle and load management

- Supports heterogeneous handler pools (different handlers for different message types)

- Enables backpressure and throttling at the distribution layer




### Considerations & Drawbacks

- Dispatcher is a single point of failure — must be made HA

- More complex than simple Competing Consumers

- Dispatcher logic can become over-complicated

- Adds a processing hop compared to direct consumption







---
**Reference**: [Original Source](https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageDispatcher.html)

