Skip to content
StackDecode
System Design
6. Distributed Systems FundamentalsAnimated

Exactly-Once and At-Least-Once Processing Semantics

How many times a message is processed.

The idea

At-most-once may lose; at-least-once may duplicate; exactly-once is achieved with idempotency or transactions.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

ProducerBrokerConsumersend msg id=9 (producer id + sequence)
  • current message
  • earlier
  • failure or attack

The broker deduplicates retries by producer id and sequence number.

step:
1/6
from:
Producer
to:
Broker
1/6

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Producer sends
  2. 2Consumer processes
  3. 3Acknowledges
  4. 4Duplicates are removed by idempotent handling

Where it is used

Messaging and payments.

Watch out for

True exactly-once delivery does not exist, only exactly-once effects.

Related