Understanding Exactly-once Semantics

Explaining how to achieve end-to-end exactly-once guarantee

Chunting Wu
Starbugs Weekly 星巴哥技術專欄

--

Photo by Aron Visuals on Unsplash

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.

  1. At most once
  2. At least once
  3. 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.

--

--

Chunting Wu
Starbugs Weekly 星巴哥技術專欄

Architect at SHOPLINE. Experienced in system design, backend development, and data engineering.