When a message key is specified in Kafka, the producer uses a partitioner (typically the default hash-based partitioner) to deterministically map all records with the same key to the same partition. Kafka guarantees order within a partition, so this enables per-key ordering.
From Kafka Producer Concepts:
“If a key is present, the producer will always route records with the same key to the same partition. Kafka preserves the order of records within a partition.”
This is essential for ordered processing and join semantics.
[Reference: Kafka Producer Design > Partitions and Keys, ============, ]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit