Class NoStoppingOffsetsInitializer

    • Constructor Detail

      • NoStoppingOffsetsInitializer

        public NoStoppingOffsetsInitializer()
    • 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: 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.