# Message Ordering

> Whether events come in the order they were sent. Most only promise it per lane.

**Field:** Data Engineering  
**Category:** Ingestion & Streaming  
**Also known as:** Event Ordering, Ordering Guarantee, In-Order Delivery

## Think of it like

It is like a line at a shop. People are served in the order they came in.

## Definition

Message ordering is whether events come out in the order they went in. Most streaming systems only promise order inside one partition. Kafka reads each partition in the exact order it was written. Across partitions, there is no order at all. So events that must stay in order, like one account's payments, share one key. The key sends them all to the same partition.

## Example

Lucy's bank keys each payment by its account. A deposit and then a withdrawal on one account always come in that order.

## Why it matters

Some events only make sense in order. A refund handled before its payment breaks the books.

## Common mistake

Expecting a whole topic to stay in order. Only each partition does, so pick the key with care.

## Three principles

- **Per partition.** Order holds inside one lane.
- **Key picks the lane.** Same key, same partition.
- **No order across lanes.** Two partitions can mix freely.

## Related terms

- [Kafka Partition](https://learn.benibix.com/term/data/kafka-partition)
- [Kafka Producer](https://learn.benibix.com/term/data/kafka-producer)
- [At-Least-Once Delivery](https://learn.benibix.com/term/data/at-least-once-delivery)
- [Exactly-Once Semantics](https://learn.benibix.com/term/data/exactly-once-semantics)
- [Event Time](https://learn.benibix.com/term/data/event-time)

![A producer writes events into a topic with three partitions, each an ordered list of numbered events. Two consumers in one group each read their own partitions, and each keeps its place with an offset.](https://learn.benibix.com/diagrams/kafka-topic-partitions.svg)

---

Source: https://learn.benibix.com/term/data/message-ordering
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
