Lesson 18 / 32
Delivery Guarantees
At-least-once, at-most-once, and the myth of exactly-once.
Three guarantees
At-most-once: send and forget, message may be lost but never duplicated. At-least-once: retry until acknowledged, message may be duplicated but never lost. Exactly-once: each message has effect exactly one time — the hardest and most expensive to guarantee end-to-end.
Registered mail vs a shout
At-most-once is shouting across a noisy room — fast, might not land. At-least-once is registered mail with return receipts — you keep resending until confirmed, so the recipient might get two copies. Exactly-once needs the recipient to also dedupe by a tracking number, effectively at-least-once delivery plus idempotent processing.
Quick check: Most real-world 'exactly-once' systems are actually built from which combination?
- At-most-once delivery + retries
- At-least-once delivery + idempotent consumers
- A single global lock
Answer
At-least-once delivery + idempotent consumers — Delivering at least once and then deduping on the consumer side is the practical way most systems achieve exactly-once effect.