public class DefaultStreamPartitioner<K,V> extends java.lang.Object implements StreamPartitioner<K,V>
Constructor and Description |
---|
DefaultStreamPartitioner(org.apache.kafka.common.serialization.Serializer<K> keySerializer,
org.apache.kafka.common.Cluster cluster) |
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
partition(java.lang.String topic,
K key,
V value,
int numPartitions)
Determine the partition number for a record with the given key and value and the current number of partitions.
|
public DefaultStreamPartitioner(org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.Cluster cluster)
public java.lang.Integer partition(java.lang.String topic, K key, V value, int numPartitions)
StreamPartitioner
partition
in interface StreamPartitioner<K,V>
topic
- the topic name this record is sent tokey
- the key of the recordvalue
- the value of the recordnumPartitions
- the total number of partitionsnumPartitions-1
, or null
if the default partitioning logic should be used