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 ofOffsetsInitializerwhich does not initialize anything.This class is used as the default stopping offsets initializer for unbounded Kafka sources.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.connector.kafka.source.enumerator.initializer.OffsetsInitializer
OffsetsInitializer.PartitionOffsetsRetriever
-
-
Constructor Summary
Constructors Constructor Description NoStoppingOffsetsInitializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.kafka.clients.consumer.OffsetResetStrategygetAutoOffsetResetStrategy()Get the auto offset reset strategy in case the initialized offsets falls out of the range.Map<org.apache.kafka.common.TopicPartition,Long>getPartitionOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions, OffsetsInitializer.PartitionOffsetsRetriever partitionOffsetsRetriever)Get the initial offsets for the given Kafka partitions.
-
-
-
Method Detail
-
getPartitionOffsets
public Map<org.apache.kafka.common.TopicPartition,Long> getPartitionOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions, OffsetsInitializer.PartitionOffsetsRetriever partitionOffsetsRetriever)
Description copied from interface:OffsetsInitializerGet 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
OffsetsOutOfRangeExceptionfrom Kafka. TheOffsetResetStrategyprovided by theOffsetsInitializer.getAutoOffsetResetStrategy()will be used to reset the offset.- Specified by:
getPartitionOffsetsin interfaceOffsetsInitializer- 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:OffsetsInitializerGet 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:
getAutoOffsetResetStrategyin interfaceOffsetsInitializer- Returns:
- An
OffsetResetStrategyto use if the initialized offsets are out of the range.
-
-