Interface KafkaContextAware<T>

All Known Implementing Classes:
KafkaSerializationSchemaWrapper

@PublicEvolving @Deprecated public interface KafkaContextAware<T>
Deprecated.
Will be turned into internal API when FlinkKafkaProducer is removed.
An interface for KafkaSerializationSchemas that need information about the context where the Kafka Producer is running along with information about the available partitions.

You only need to override the methods for the information that you need. However, getTargetTopic(Object) is required because it is used to determine the available partitions.

  • Method Summary

    Modifier and Type
    Method
    Description
    getTargetTopic(T element)
    Deprecated.
    Returns the topic that the presented element should be sent to.
    default void
    setNumParallelInstances(int numParallelInstances)
    Deprecated.
    Sets the parallelism with which the parallel task of the Kafka Producer runs.
    default void
    setParallelInstanceId(int parallelInstanceId)
    Deprecated.
    Sets the number of the parallel subtask that the Kafka Producer is running on.
    default void
    setPartitions(int[] partitions)
    Deprecated.
    Sets the available partitions for the topic returned from getTargetTopic(Object).
  • Method Details

    • setParallelInstanceId

      default void setParallelInstanceId(int parallelInstanceId)
      Deprecated.
      Sets the number of the parallel subtask that the Kafka Producer is running on. The numbering starts from 0 and goes up to parallelism-1 (parallelism as returned by setNumParallelInstances(int)).
    • setNumParallelInstances

      default void setNumParallelInstances(int numParallelInstances)
      Deprecated.
      Sets the parallelism with which the parallel task of the Kafka Producer runs.
    • setPartitions

      default void setPartitions(int[] partitions)
      Deprecated.
      Sets the available partitions for the topic returned from getTargetTopic(Object).
    • getTargetTopic

      String getTargetTopic(T element)
      Deprecated.
      Returns the topic that the presented element should be sent to. This is not used for setting the topic (this is done via the ProducerRecord that is returned from KafkaSerializationSchema.serialize(Object, Long), it is only used for getting the available partitions that are presented to setPartitions(int[]).