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 java.lang.Object implements StreamPartitioner<K,V>
-
-
Constructor Summary
Constructors Constructor Description DefaultStreamPartitioner(org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.Cluster cluster)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Constructor Detail
-
DefaultStreamPartitioner
public DefaultStreamPartitioner(org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.Cluster cluster)
-
-
Method Detail
-
partition
public java.lang.Integer partition(java.lang.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
-
-