Middle+
Do we get the same order of messages at the output as was at the input in a Kafka topic with three partitions?
sobes.tech AI
Answer from AI
In Kafka, message order is guaranteed only within a single partition, not across all partitions of a topic. If you have a topic with three partitions, then:
- Messages sent to the same partition will be received in the order they were written.
- The order between different partitions is not guaranteed, as they are processed in parallel.
Therefore, if messages are distributed across partitions (for example, by key), the order is preserved only for messages with the same key that go to the same partition. If you want to maintain a global order of all messages, you need to use a single partition, but this will limit scalability.