Class DefaultStreamPartitioner<K,V>
- java.lang.Object
-
- org.apache.kafka.streams.processor.internals.DefaultStreamPartitioner<K,V>
-
- All Implemented Interfaces:
StreamPartitioner<K,V>
public class DefaultStreamPartitioner<K,V> extends Object implements StreamPartitioner<K,V>
-
-
Constructor Summary
Constructors Constructor Description DefaultStreamPartitioner(Serializer<K> keySerializer, Cluster cluster)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Integer
partition(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.
-
-
-
Constructor Detail
-
DefaultStreamPartitioner
public DefaultStreamPartitioner(Serializer<K> keySerializer, Cluster cluster)
-
-
Method Detail
-
partition
public Integer partition(String topic, K key, V value, int numPartitions)
Description copied from interface:StreamPartitioner
Determine the partition number for a record with the given key and value and the current number of partitions.- Specified by:
partition
in interfaceStreamPartitioner<K,V>
- Parameters:
topic
- the topic name this record is sent tokey
- the key of the recordvalue
- the value of the recordnumPartitions
- the total number of partitions- Returns:
- an integer between 0 and
numPartitions-1
, ornull
if the default partitioning logic should be used
-
-