Systems & Backend

Message Queue

A buffer that lets services hand off work asynchronously — the producer drops a message, the consumer picks it up later.

A message queue decouples producers from consumers: a producer writes a message and moves on, and one or more consumers process messages at their own pace. It absorbs traffic spikes, smooths load, and lets components fail independently.

Worked example: a checkout service drops an “order placed” message and returns instantly; separate workers handle email, inventory, and billing from the queue — if the email worker is down, its messages simply wait. Gotcha: queues turn synchronous errors into asynchronous ones — you must design for retries, ordering, and duplicate delivery (most queues are at-least-once), and for what happens when a message can never be processed (a dead-letter queue).