View Source KafkaEx.Producer.Partitioner.Legacy (kafka_ex v1.0.0-rc.1)
Legacy default partitioner implementation.
DEPRECATED: This partitioner will be removed in KafkaEx v2.0.
Use KafkaEx.Producer.Partitioner.Default instead, which is compatible with
the Java Kafka client's default partitioner.
Background
This "legacy partitioner" was the default partitioner for KafkaEx before v1.0. It was intended to match the behaviour of the default Java client, however there were small differences in the murmur2 hash masking:
- Legacy: Uses unsigned 32-bit masking (
band(0xFFFFFFFF)) - Default: Uses signed 31-bit masking (
band(0x7FFFFFFF)) - Java compatible
This legacy partitioner is provided for backward compatibility with existing
applications that rely on the previous partitioning behavior. New applications
should use KafkaEx.Producer.Partitioner.Default.
Migration
If you're using this partitioner, migrate to KafkaEx.Producer.Partitioner.Default:
# Before (deprecated)
config :kafka_ex, partitioner: KafkaEx.Producer.Partitioner.Legacy
# After
config :kafka_ex, partitioner: KafkaEx.Producer.Partitioner.DefaultNote: Changing partitioners may cause messages with the same key to be routed to different partitions. Plan your migration accordingly.