The tempting promise
Exactly once delivery means every message is processed one time, never lost and never duplicated. It sounds ideal, but over an unreliable network it is impossible in the strict sense. A sender can never be sure whether a lost acknowledgment means the message was processed or not.
The three delivery guarantees
- At most once: send and forget. Fast, but messages can be lost.
- At least once: retry until acknowledged. Nothing is lost, but duplicates happen.
- Exactly once: the ideal, achievable only as an illusion built on top of at least once.
How real systems fake it
The trick is at least once delivery plus idempotent processing or deduplication. The network may deliver a message twice, but the consumer recognizes the duplicate and produces the same end state as a single delivery.
This is often called exactly once semantics to distinguish it from literal exactly once delivery. The message may arrive many times, but its observable effect happens once.
Key idea
Exactly once delivery is unachievable over a flaky network, but exactly once effect is achievable by combining at least once delivery with deduplication.