← Concepts
Communication·3 min read

Message Queues

Decouple producers from consumers with a durable buffer so spikes get absorbed and slow work happens asynchronously.

First time reading this? Start here

Plain English: instead of Service A calling Service B directly and waiting, A drops a message in a queue and moves on. B picks it up whenever it's ready. This soaks up traffic spikes, survives B being down for a while, and lets slow work happen in the background.

Used in:WhatsAppNotification SystemApache Kafka
What it is

A durable, intermediary buffer that decouples producers (who enqueue messages) from consumers (who dequeue and process them). Classic brokers (RabbitMQ, SQS) deliver-then-delete per message; log-based systems (Kafka) keep an ordered, replayable log that consumers read by offset. Both let work happen asynchronously and absorb load.

The problem it solves

Synchronous coupling is fragile: if A calls B directly and B is slow or down, A blocks or fails. A queue breaks that link: A enqueues and continues, B processes at its own pace. Queues also absorb bursts (a traffic spike fills the queue instead of melting the consumer), enable async work (resize the image after the upload returns), and let you scale consumers independently of producers.

How it works

Producers publish messages to a queue or topic. The broker persists them (so they survive a crash). Consumers pull (or are pushed) messages, process them, and acknowledge. Unacked messages are redelivered (at-least-once delivery). Failed messages eventually land in a dead-letter queue. Log-based brokers like Kafka instead keep messages on disk by offset, letting multiple consumer groups read the same stream and replay history.

Why use it
What it costs you
Where it shows up in our architectures
Gotchas

Your notes

Private to you