Sobes.tech
Junior — Middle

Is it possible to ensure message reading order in a Topic if messages are distributed across three partitions?

sobes.tech AI

Answer from AI

In Apache Kafka, if messages are distributed across three partitions in a single Topic, it is not possible to guarantee global message read order across the entire Topic. The order is only guaranteed within a single partition — messages within one partition are ordered and read in the same sequence they were written.

If global order is important, typically:

  • Use a single partition (but this reduces scalability).
  • Or ensure message keys so that related messages go to the same partition.

Thus, with three partitions, it is not possible to guarantee message read order across the entire Topic, but within each partition — it is possible.