Senior
Is it possible to read messages from a topic with three partitions in the same order in which they were written?
sobes.tech AI
Answer from AI
In Apache Kafka, message order is only guaranteed within a single partition. If a topic has three partitions, messages written to different partitions can be read in any order relative to each other.
That is, to read messages in the same order they were written, you need to read from one partition. However, if you read from all three partitions simultaneously, the overall message order is not preserved.
Example: if messages with key A always go to partition 0, then the order for key A will be maintained. But if messages with different keys are distributed across different partitions, the overall order across the entire topic is not guaranteed.