What is a Message Broker
A message broker is a piece of infrastructure software that sits between message producers and consumers. It receives messages, stores them (at least temporarily), and delivers them to the appropriate consumers.
How it works
Producers send messages to the broker. The broker routes them based on configuration — to a queue (point-to-point), a topic (pub/sub), or through routing rules. Consumers connect to the broker and receive messages.
The broker handles durability (persisting messages to disk), delivery guarantees (at-least-once, at-most-once), and consumer tracking (which messages have been acknowledged).
Common implementations
Apache Kafka — distributed log. Messages are appended to partitioned topics and retained for a configurable period. Consumers track their position (offset) in the log. High throughput, replayable.
RabbitMQ — traditional message broker implementing AMQP. Supports queues, exchanges, routing keys, and multiple messaging patterns. Messages are deleted after acknowledgment.
Redis — provides both pub/sub (fire-and-forget) and Streams (durable log with consumer groups). Lightweight, in-memory, often already in the stack.
Why it matters
A message broker decouples producers from consumers in time, availability, and location. Without a broker, services must call each other directly, creating tight coupling and runtime dependencies.
For how brokers fit into system design, see How Event-Driven Architecture Works.