What is a message broker, what problems does it solve, and what does adding one cost you?
Short answer
A message broker sits in the middle, receiving, storing, then delivering messages from producers to consumers: it decouples services, absorbs spikes, enables async processing and fan-out. The cost: one more distributed system to run, eventual consistency, duplicate or out-of-order messages.
3 points to say:
- Decoupling in time (orders still accepted while a receiver is down) and in receivers (fan-out without knowing who listens).
- Load leveling: 10K orders/second in a flash sale get queued, consumers work through 2K/second instead of crashing.
- The price: operations, eventual consistency, duplicates, ordering, dual write; for small volumes use a job table in the DB, when you need the result now call synchronously.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.