Interface ConsumerSeekAware.ConsumerSeekCallback
- Enclosing interface:
- ConsumerSeekAware
public static interface ConsumerSeekAware.ConsumerSeekCallback
A callback that a listener can invoke to seek to a specific offset.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Perform a seek operation.void
seekRelative
(String topic, int partition, long offset, boolean toCurrent) Perform a seek relative to the start, end, or current position.void
seekToBeginning
(String topic, int partition) Perform a seek to beginning operation.default void
seekToBeginning
(Collection<org.apache.kafka.common.TopicPartition> partitions) Perform a seek to beginning operation.void
Perform a seek to end operation.default void
seekToEnd
(Collection<org.apache.kafka.common.TopicPartition> partitions) Perform a seek to end operation.void
seekToTimestamp
(String topic, int partition, long timestamp) Perform a seek to the first offset greater than or equal to the time stamp.void
seekToTimestamp
(Collection<org.apache.kafka.common.TopicPartition> topicPartitions, long timestamp) Perform a seek to the first offset greater than or equal to the time stamp.
-
Method Details
-
seek
Perform a seek operation. When called fromConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekCallback)
or fromConsumerSeekAware.onIdleContainer(Map, ConsumerSeekCallback)
perform the seek immediately on the consumer. When called from elsewhere, queue the seek operation to the consumer. The queued seek will occur after any pending offset commits. The consumer must be currently assigned the specified partition.- Parameters:
topic
- the topic.partition
- the partition.offset
- the offset (absolute).
-
seekToBeginning
Perform a seek to beginning operation. When called fromConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekCallback)
or fromConsumerSeekAware.onIdleContainer(Map, ConsumerSeekCallback)
perform the seek immediately on the consumer. When called from elsewhere, queue the seek operation to the consumer. The queued seek will occur after any pending offset commits. The consumer must be currently assigned the specified partition.- Parameters:
topic
- the topic.partition
- the partition.
-
seekToBeginning
Perform a seek to beginning operation. When called fromConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekCallback)
or fromConsumerSeekAware.onIdleContainer(Map, ConsumerSeekCallback)
perform the seek immediately on the consumer. When called from elsewhere, queue the seek operation to the consumer for eachTopicPartition
. The seek will occur after any pending offset commits. The consumer must be currently assigned the specified partition(s).- Parameters:
partitions
- theTopicPartition
s.- Since:
- 2.3.4
-
seekToEnd
Perform a seek to end operation. When called fromConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekCallback)
or fromConsumerSeekAware.onIdleContainer(Map, ConsumerSeekCallback)
perform the seek immediately on the consumer. When called from elsewhere, queue the seek operation to the consumer. The queued seek will occur after any pending offset commits. The consumer must be currently assigned the specified partition.- Parameters:
topic
- the topic.partition
- the partition.
-
seekToEnd
Perform a seek to end operation. When called fromConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekCallback)
or fromConsumerSeekAware.onIdleContainer(Map, ConsumerSeekCallback)
perform the seek immediately on the consumer. When called from elsewhere, queue the seek operation to the consumer for eachTopicPartition
. The queued seek(s) will occur after any pending offset commits. The consumer must be currently assigned the specified partition(s).- Parameters:
partitions
- theTopicPartition
s.- Since:
- 2.3.4
-
seekRelative
Perform a seek relative to the start, end, or current position. When called fromConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekCallback)
or fromConsumerSeekAware.onIdleContainer(Map, ConsumerSeekCallback)
perform the seek immediately on the consumer. When called from elsewhere, queue the seek operation. The queued seek will occur after any pending offset commits. The consumer must be currently assigned the specified partition.- Parameters:
topic
- the topic.partition
- the partition.offset
- the offset; positive values are relative to the start, negative values are relative to the end, unless toCurrent is true.toCurrent
- true for the offset to be relative to the current position rather than the beginning or end.- Since:
- 2.3
-
seekToTimestamp
Perform a seek to the first offset greater than or equal to the time stamp. When called fromConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekCallback)
or fromConsumerSeekAware.onIdleContainer(Map, ConsumerSeekCallback)
perform the seek immediately on the consumer. When called from elsewhere, queue the seek operation. The queued seek will occur after any pending offset commits. The consumer must be currently assigned the specified partition. UseseekToTimestamp(Collection, long)
when seeking multiple partitions because the offset lookup is blocking.- Parameters:
topic
- the topic.partition
- the partition.timestamp
- the time stamp.- Since:
- 2.3
- See Also:
-
seekToTimestamp
void seekToTimestamp(Collection<org.apache.kafka.common.TopicPartition> topicPartitions, long timestamp) Perform a seek to the first offset greater than or equal to the time stamp. When called fromConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekCallback)
or fromConsumerSeekAware.onIdleContainer(Map, ConsumerSeekCallback)
perform the seek immediately on the consumer. When called from elsewhere, queue the seek operation. The queued seek will occur after any pending offset commits. The consumer must be currently assigned the specified partition.- Parameters:
topicPartitions
- the topic/partitions.timestamp
- the time stamp.- Since:
- 2.3
-