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

Message Ordering

Keeping messages in order.

The idea

Queues can preserve order per partition or key but not globally at scale.

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. 1Assign a key
  2. 2Messages with the same key go to one partition
  3. 3Consumers read in order
  4. 4Parallelism comes from many keys

Where it is used

Account updates.

Watch out for

Global ordering limits throughput.

Related