# `Klife.Producer.DefaultPartitioner`
[🔗](https://github.com/oliveigah/klife/blob/main/lib/klife/producer/default_partitioner.ex#L1)

Default partitioner implementation compatible with Kafka's DefaultPartitioner.

Uses the following logic:

- if record key is `nil` then assigns a random partition
- if record key is not `nil` then 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.).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
