Klife.Producer.DefaultPartitioner (Klife v1.0.0)
View SourceDefault partitioner implementation compatible with Kafka's DefaultPartitioner.
Uses the following logic:
- if record key is
nilthen assigns a random partition - if record key is not
nilthen assigns a partition using Kafka's Murmur2 hash
This ensures that records with the same key are assigned to the same partition regardless of whether they are produced by klife or any other compliant Kafka client (Java, Python, Go, etc.).