Interface Partitioner

  • All Superinterfaces:
    java.io.Serializable
    All Known Implementing Classes:
    FirstPartitionPartitioner, KeyAttributePartitioner, KeyPartitioner, TransactionPartitioner
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Partitioner
    extends java.io.Serializable
    An interface that each class configured in KafkaCommitLog.PARTITIONER_CLASS must implement. The class also has to have a default (empty) constructor.
    • Method Detail

      • getPartitionId

        int getPartitionId​(StreamElement element)
        Retrieve partition ID for the specified ingest. All ingests that have the same partition ID are guaranteed to be written to the same Kafka partition.
        Parameters:
        element - element to calculate partition for
        Returns:
        ID of partition (can be negative)
      • setup

        default void setup​(java.util.Map<java.lang.String,​?> map)
        Setup the partitioner (if needed).
        Parameters:
        map - a configuration map
      • close

        default void close()
        Close the partitioner after usage.