Class DefaultStreamPartitioner<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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 interface StreamPartitioner<K,​V>
        Parameters:
        topic - the topic name this record is sent to
        key - the key of the record
        value - the value of the record
        numPartitions - the total number of partitions
        Returns:
        an integer between 0 and numPartitions-1, or null if the default partitioning logic should be used