A vendor says its broker offers "exactly once". How would you evaluate that claim?
Sketch your own answer first, then compare it with the one below.
A strong answer
Ask what is counted once. A broker can avoid duplicate writes inside its own storage. It cannot control what your consumer does with a message, such as a call to a payment API.
A realistic guarantee is effectively-once: at-least-once delivery plus either idempotent processing or a transaction that commits the result and the read position together. That works where the effect and the position live in the same system, and it stops at the boundary with outside systems.
Probe the boundary: what happens on producer retries, and on a failure during a commit? The end-to-end argument is the reason. Only the application knows what "the same effect" means, so the final guarantee is completed there.
Sources
- J. H. Saltzer, D. P. Reed, D. D. Clark (1984). End-to-end arguments in system design.
- Neha Narkhede (2017). Exactly-once Semantics are Possible: Here's How Apache Kafka Does it.
- Tyler Akidau and others (2013). MillWheel: fault-tolerant stream processing at internet scale.