Interface OffsetsInitializer.PartitionOffsetsRetriever

All Known Implementing Classes:
KafkaSourceEnumerator.PartitionOffsetsRetrieverImpl
Enclosing interface:
OffsetsInitializer

public static interface OffsetsInitializer.PartitionOffsetsRetriever
An interface that provides necessary information to the OffsetsInitializer to get the initial offsets of the Kafka partitions.
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<org.apache.kafka.common.TopicPartition,Long>
    beginningOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions)
    List beginning offsets for the specified partitions.
    Map<org.apache.kafka.common.TopicPartition,Long>
    committedOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions)
    The group id should be the set for KafkaSource before invoking this method.
    Map<org.apache.kafka.common.TopicPartition,Long>
    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.
  • Method Details

    • committedOffsets

      Map<org.apache.kafka.common.TopicPartition,Long> committedOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions)
      The group id should be the set for KafkaSource before invoking this method. Otherwise an IllegalStateException will be thrown.
      Throws:
      IllegalStateException - if the group id is not set for the KafkaSource.
      See Also:
      • Admin.listConsumerGroupOffsets(String, ListConsumerGroupOffsetsOptions)
    • endOffsets

      Map<org.apache.kafka.common.TopicPartition,Long> endOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions)
      List end offsets for the specified partitions.
    • beginningOffsets

      Map<org.apache.kafka.common.TopicPartition,Long> beginningOffsets(Collection<org.apache.kafka.common.TopicPartition> partitions)
      List beginning offsets for the specified partitions.
    • offsetsForTimes

      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.