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

Message Retention

How long messages are kept.

The idea

Retention policies keep messages for a time or size, allowing replay.

Watch it work

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

ProducerEvent brokerBillingEmailAnalytics
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

A service publishes an event: "OrderPlaced".

step:
1/4
at:
Producer
1/8

The green dot is a request moving through the system.

Step by step

  1. 1Set the retention
  2. 2Messages age out
  3. 3Consumers can replay within the window
  4. 4Old data is deleted

Where it is used

Streams and audit.

Watch out for

A slow consumer can fall off the end of the retention window.

Related