Keys and ordering
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
choose a key that keeps the ordering that matters.
Planned topics
- The producer picks the partition from the key hash; the same key always goes to the same partition (while partition count is unchanged).
- Key by the entity whose events must stay in order:
orderIdfor order events. - A null key spreads records across partitions; no ordering between them.
- A hot key (one huge customer) overloads one partition.
- Ordering across different keys is not guaranteed and rarely needed.
Draft outline details
Demonstration
OrderPlaced(o-42), OrderPaid(o-42), OrderShipped(o-42) all land in partition 1 in order.
Check your understanding
What key keeps all events of one order together?
Show answer
The order ID.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.