Interface KafkaPartitioner<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void open​(int parallelInstanceId, int parallelInstances)
      Initializer for the partitioner.
      int partition​(T record, byte[] key, byte[] value, String targetTopic, int[] partitions)
      Determine the id of the partition that the record should be written to.
    • Method Detail

      • open

        default void open​(int parallelInstanceId,
                          int parallelInstances)
        Initializer for the partitioner. This is called once on each parallel sink instance of the Flink Kafka producer. This method should be overridden if necessary.
        Parameters:
        parallelInstanceId - 0-indexed id of the parallel sink instance in Flink
        parallelInstances - the total number of parallel instances
      • partition

        int partition​(T record,
                      byte[] key,
                      byte[] value,
                      String targetTopic,
                      int[] partitions)
        Determine the id of the partition that the record should be written to.
        Parameters:
        record - the record value
        key - serialized key of the record
        value - serialized value of the record
        targetTopic - target topic for the record
        partitions - found partitions for the target topic
        Returns:
        the id of the target partition