Skip to content
StackDecode
System Design
9. Message Queues and Event-Driven SystemsAnimated

Message Deduplication

Ignoring duplicate messages.

The idea

Messages may be delivered more than once. A unique id lets consumers skip repeats.

Watch it work

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

ClientAPIDatabasePOST /pay Idempotency-Key: k1
  • current message
  • earlier
  • failure or attack

The client attaches a unique key to a risky request.

step:
1/6
from:
Client
to:
API
1/6

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

Step by step

  1. 1Attach a unique id
  2. 2Consumer checks if seen
  3. 3If seen, skip
  4. 4Otherwise process and record

Where it is used

At-least-once delivery.

Watch out for

The seen-id store must be fast and durable.

Related