What do at-most-once, at-least-once and exactly-once delivery mean?
Sketch your own answer first, then compare it with the one below.
A strong answer
At most once: a message is delivered zero or one times. It may be lost, and it is never repeated. At least once: a message is delivered one or more times. It is never lost, and it may be repeated. Exactly once: the effect of each message happens once.
At-most-once comes from acknowledging before the work. At-least-once comes from acknowledging after the work, with redelivery on timeout. Exactly once cannot be had from delivery alone and is built on top of at-least-once.
Concrete cases make the difference clear. A metrics sample can tolerate loss. A payment tolerates neither loss nor repetition.
Sources
- Martin Kleppmann (2017). Designing Data-Intensive Applications.
- RabbitMQ documentation (2024). Consumer acknowledgements and publisher confirms.