Buffering work between systems.
WHAT A QUEUE DOES
Holds messages until something processes them.
WHAT THAT PROVIDES
The producer not waiting Absorbing bursts Retry without the producer's involvement Systems that do not fail together
WHAT THE PARTS ARE
A producer A queue or topic One or more consumers
WHAT THE DIFFERENCE BETWEEN A QUEUE AND A TOPIC IS
A queue delivers each message to one consumer; a topic delivers to every subscriber.
WHAT DELIVERY GUARANTEES EXIST
At most once, risking loss At least once, risking duplicates Exactly once, which is difficult and usually approximate
WHAT MOST SYSTEMS PROVIDE
At least once.
WHAT THAT DEMANDS OF CONSUMERS
Idempotency.
WHY
Duplicates are certain, not hypothetical.
WHAT ACKNOWLEDGEMENT MEANS
Telling the queue the message was processed.
WHEN TO ACKNOWLEDGE
After processing succeeds, never before.
WHY
Acknowledging first loses the message on failure.
WHAT A DEAD LETTER QUEUE IS
Where messages go after repeated failure.
WHY IT MATTERS
One unprocessable message otherwise blocks everything behind it.
WHAT TO MONITOR
Queue depth Message age Dead letter count