Exactly-Once: The Mathematical Impossibility
Exactly-once processing is impossible in a distributed system because you cannot guarantee the delivery of the (acknowledgement) over an unreliable network.
1. The Two Generals' Problem
Two generals must agree on an attack time over an unreliable communication channel. It is mathematically proven that they can never reach agreement with certainty.
2. Effectively Exactly-Once
We simulate exactly-once via Idempotency.
- You do send the message twice, but the consumer detects the duplicate ID and ignores the second attempt.
Conclusion: Exactly-once is a developer abstraction. The infrastructure underneath is always doing "At-least-once" delivery + "Idempotent" processing.
