Class KinesisPartitioner<T>

  • Type Parameters:
    T - record type
    All Implemented Interfaces:
    Serializable, java.util.function.Function<T,​String>, org.apache.flink.connector.kinesis.sink.PartitionKeyGenerator<T>

    @PublicEvolving
    public abstract class KinesisPartitioner<T>
    extends Object
    implements Serializable, org.apache.flink.connector.kinesis.sink.PartitionKeyGenerator<T>
    An interface for partitioning records.
    See Also:
    Serialized Form
    • Constructor Detail

      • KinesisPartitioner

        public KinesisPartitioner()
    • Method Detail

      • getPartitionId

        public abstract String getPartitionId​(T element)
        Return a partition id based on the input.
        Parameters:
        element - Element to partition
        Returns:
        A string representing the partition id
      • getExplicitHashKey

        public String getExplicitHashKey​(T element)
        Optional method for setting an explicit hash key.
        Parameters:
        element - Element to get the hash key for
        Returns:
        the hash key for the element
      • initialize

        public void initialize​(int indexOfThisSubtask,
                               int numberOfParallelSubtasks)
        Optional initializer.
        Parameters:
        indexOfThisSubtask - Index of this partitioner instance
        numberOfParallelSubtasks - Total number of parallel instances
      • apply

        public String apply​(T element)
        Specified by:
        apply in interface java.util.function.Function<T,​String>