Exactly-Once Semantics¶
"Exactly-once" is one of the most misused phrases in distributed systems. True exactly-once delivery across a network is provably impossible in general — what real systems actually deliver is at-least-once delivery plus exactly-once effect, achieved through idempotency and transactional tricks.
flowchart LR
Junior["Junior: why exactly-once delivery is impossible"] --> Middle["Middle: exactly-once EFFECT via idempotency"]
Middle --> Senior["Senior: transactional outbox and read-process-write atomicity"]
Senior --> Professional["Professional: Kafka's actual exactly-once implementation"]
flowchart LR
Delivery["Exactly-once DELIVERY\n(impossible in general)"] -.-.- Effect["Exactly-once EFFECT\n(achievable via idempotency\n+ deduplication)"]
Choose a level¶
| Level | Guide | You are done when |
|---|---|---|
| Junior | Why exactly-once delivery is impossible | You can explain the fundamental network-uncertainty problem that rules out true exactly-once delivery. |
| Middle | Exactly-once effect via idempotency | You can explain the distinction between delivery and effect, and why the latter is what actually matters. |
| Senior | Transactional outbox | You can design a read-process-write pipeline that achieves exactly-once effect end to end. |
| Professional | Kafka's real implementation | You can explain how Kafka's idempotent producer and transactions actually implement "exactly-once" internally. |
Practice rule¶
Whenever someone claims a system provides "exactly-once processing," ask: "exactly-once delivery, or exactly-once effect?" If they can't answer the distinction, they likely mean effect (achieved via idempotency) — true delivery-level exactly-once doesn't exist over an unreliable network, full stop.