Class KafkaSourceEnumerator.PartitionOffsetsRetrieverImpl
java.lang.Object
org.apache.flink.connector.kafka.source.enumerator.KafkaSourceEnumerator.PartitionOffsetsRetrieverImpl
- All Implemented Interfaces:
AutoCloseable,OffsetsInitializer.PartitionOffsetsRetriever
- Enclosing class:
KafkaSourceEnumerator
@VisibleForTesting
public static class KafkaSourceEnumerator.PartitionOffsetsRetrieverImpl
extends Object
implements OffsetsInitializer.PartitionOffsetsRetriever, AutoCloseable
The implementation for offsets retriever with a consumer and an admin client.
-
Constructor Summary
ConstructorsConstructorDescriptionPartitionOffsetsRetrieverImpl(org.apache.kafka.clients.admin.AdminClient adminClient, String groupId) -
Method Summary
Modifier and TypeMethodDescriptionbeginningOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions) List beginning offsets for the specified partitions.voidclose()committedOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions) The group id should be the set forKafkaSourcebefore invoking this method.endOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions) List end offsets for the specified partitions.Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.consumer.OffsetAndTimestamp> offsetsForTimes(Map<org.apache.kafka.common.TopicPartition, Long> timestampsToSearch) List offsets matching a timestamp for the specified partitions.
-
Constructor Details
-
PartitionOffsetsRetrieverImpl
public PartitionOffsetsRetrieverImpl(org.apache.kafka.clients.admin.AdminClient adminClient, String groupId)
-
-
Method Details
-
committedOffsets
public Map<org.apache.kafka.common.TopicPartition,Long> committedOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions) Description copied from interface:OffsetsInitializer.PartitionOffsetsRetrieverThe group id should be the set forKafkaSourcebefore invoking this method. Otherwise anIllegalStateExceptionwill be thrown.- Specified by:
committedOffsetsin interfaceOffsetsInitializer.PartitionOffsetsRetriever- See Also:
-
endOffsets
public Map<org.apache.kafka.common.TopicPartition,Long> endOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions) Description copied from interface:OffsetsInitializer.PartitionOffsetsRetrieverList end offsets for the specified partitions.- Specified by:
endOffsetsin interfaceOffsetsInitializer.PartitionOffsetsRetriever
-
beginningOffsets
public Map<org.apache.kafka.common.TopicPartition,Long> beginningOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions) Description copied from interface:OffsetsInitializer.PartitionOffsetsRetrieverList beginning offsets for the specified partitions.- Specified by:
beginningOffsetsin interfaceOffsetsInitializer.PartitionOffsetsRetriever
-
offsetsForTimes
public Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndTimestamp> offsetsForTimes(Map<org.apache.kafka.common.TopicPartition, Long> timestampsToSearch) Description copied from interface:OffsetsInitializer.PartitionOffsetsRetrieverList offsets matching a timestamp for the specified partitions.- Specified by:
offsetsForTimesin interfaceOffsetsInitializer.PartitionOffsetsRetriever
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-