Class NoStoppingOffsetsInitializer

java.lang.Object
org.apache.flink.connector.kafka.source.enumerator.initializer.NoStoppingOffsetsInitializer
All Implemented Interfaces:
Serializable, OffsetsInitializer

@Internal public class NoStoppingOffsetsInitializer extends Object implements OffsetsInitializer
An implementation of OffsetsInitializer which does not initialize anything.

This class is used as the default stopping offsets initializer for unbounded Kafka sources.

See Also:
  • Constructor Details

    • NoStoppingOffsetsInitializer

      public NoStoppingOffsetsInitializer()
  • Method Details

    • getPartitionOffsets

      public Map<org.apache.kafka.common.TopicPartition,Long> getPartitionOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions, OffsetsInitializer.PartitionOffsetsRetriever partitionOffsetsRetriever)
      Description copied from interface: OffsetsInitializer
      Get the initial offsets for the given Kafka partitions. These offsets will be used as either starting offsets or stopping offsets of the Kafka partitions.

      If the implementation returns a starting offset which causes OffsetsOutOfRangeException from Kafka. The OffsetResetStrategy provided by the OffsetsInitializer.getAutoOffsetResetStrategy() will be used to reset the offset.

      Specified by:
      getPartitionOffsets in interface OffsetsInitializer
      Parameters:
      partitions - the Kafka partitions to get the starting offsets.
      partitionOffsetsRetriever - a helper to retrieve information of the Kafka partitions.
      Returns:
      A mapping from Kafka partition to their offsets to start consuming from.
    • getAutoOffsetResetStrategy

      public org.apache.kafka.clients.consumer.OffsetResetStrategy getAutoOffsetResetStrategy()
      Description copied from interface: OffsetsInitializer
      Get the auto offset reset strategy in case the initialized offsets falls out of the range.

      The OffsetStrategy is only used when the offset initializer is used to initialize the starting offsets and the starting offsets is out of range.

      Specified by:
      getAutoOffsetResetStrategy in interface OffsetsInitializer
      Returns:
      An OffsetResetStrategy to use if the initialized offsets are out of the range.