Partitioner¶
Partitioner
is an abstraction of partitioners for a KafkaProducer to determine the partition of records (to be sent out).
Configurable¶
Partitioner
is a Configurable.
Closeable¶
Partitioner
is a Closeable
(Java).
Contract¶
onNewBatch¶
void onNewBatch(
String topic,
Cluster cluster,
int prevPartition)
Used when:
KafkaProducer
is requested to send a record (and doSend)
Computing Partition¶
int partition(
String topic,
Object key,
byte[] keyBytes,
Object value,
byte[] valueBytes,
Cluster cluster)
Used when:
KafkaProducer
is requested to send a record (and determines the partition)
Implementations¶
- DefaultPartitioner
- UniformStickyPartitioner
- RoundRobinPartitioner