What Is a Message Broker? The Hub That Routes Messages
A message broker is middleware that receives messages from producers and routes them to the right consumers based on rules you configure.
Where a queue is a single buffer, a message broker is the system that manages many queues and topics, decides where each message goes, and handles delivery, persistence, and retries. RabbitMQ, Kafka, and cloud services like SQS or Pub/Sub all play this role. The broker is the backbone of an event-driven or asynchronous system.
What a broker does
A broker accepts messages, applies routing rules to decide which queues or subscribers receive them, persists them as configured, and tracks delivery and acknowledgment. It is the central piece of messaging infrastructure that producers and consumers both connect to.
Queue versus broker
A queue is one buffer; a broker is the server that hosts queues and topics, enforces routing, and manages delivery semantics. You interact with a queue; you operate a broker.
Common routing models
- Point-to-point: one message to exactly one consumer.
- Publish-subscribe: one message fanned out to many subscribers.
- Topic or routing keys: messages matched to interested consumers.
- Dead-letter routing: undeliverable messages set aside.
Brokers in the pipeline
Realistic tests need the broker running. CI commonly starts the broker as a service container, exercises publish-and-consume paths, and tears it down per run. That gives confidence in routing and delivery behavior that mocks cannot provide.
Operational weight
A broker is critical infrastructure: if it is down, async flows stall. That raises the bar on deploy safety, health checks, and monitoring around the broker, and makes its configuration something you usually manage as code and test in CI.
Keeping broker tests fast
Booting a broker every test run is not free. Warm managed runners (such as Latchkey) keep that startup tax small so broker-backed integration suites stay quick.
Key takeaways
- A message broker is the server that routes, persists, and delivers messages.
- A queue is a single buffer; a broker manages many queues and topics with routing rules.
- Realistic broker tests need the broker running, which adds CI startup time.