Member-only story
Understanding Exactly-once Semantics
Explaining how to achieve end-to-end exactly-once guarantee
Previously, when discussing message queues, we mentioned that when selecting a message queue, we should consider its delivery guarantee. Depending on the needs, there are different requirements for the delivery guarantee. The more critical the application, the higher level of guarantee is required.
There are three different levels of delivery guarantees, ranging from weak to strong as follows.
- At most once
- At least once
- Exactly once
When we define a delivery guarantee, in fact, we need to understand the scope of the guarantee. In an end-to-end delivery guarantee, there are three different paths that work together to define a complete end-to-end delivery guarantee.
These three paths are as follows.
- Producer Perspective
- Consumer Perspective
- Sink Perspective
An end-to-end delivery guarantee is actually determined by the weakest of these three paths. For example, if the producer has an exactly-once guarantee, but the consumer can only achieve at-least once, and the sink has at-least once too, then end-to-end is at-least once guaranteed.