Class NoStoppingOffsetsInitializer
java.lang.Object
org.apache.flink.connector.kafka.source.enumerator.initializer.NoStoppingOffsetsInitializer
- All Implemented Interfaces:
Serializable,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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.connector.kafka.source.enumerator.initializer.OffsetsInitializer
OffsetsInitializer.PartitionOffsetsRetriever -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.kafka.clients.consumer.OffsetResetStrategyGet the auto offset reset strategy in case the initialized offsets falls out of the range.getPartitionOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions, OffsetsInitializer.PartitionOffsetsRetriever partitionOffsetsRetriever) Get the initial offsets for the given Kafka partitions.
-
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: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.
-