KafkaConsumer.commitAsync()行为的偏移量比以前的偏移量低 [英] KafkaConsumer.commitAsync() behavior with a lower offset than previous
问题描述
kafka将如何处理对的呼叫
How will kafka deal with a call to
KafkaConsumer.commitAsync(Map<TopicPartition, OffsetAndMetadata> offsets, OffsetCommitCallback callback)
给定主题的偏移量值小于上一次调用时的值吗?
when offset value for a topic is given as a lesser value than a previous invocation?
推荐答案
它将简单地将分区的偏移量设置为您指定的值,因此下一次您将消耗来自commitedOffset + 1的消息.
commitAsync()
的Javadoc说:
It will simply set the offset of the partition to the value you specified,so next time you will consume you message from commitedOffset+1.
The javadoc of commitAsync()
says:
已提交的偏移量应该是您的应用程序将使用的下一条消息,即lastProcessedMessageOffset +1.
The committed offset should be the next message your application will consume,i.e. lastProcessedMessageOffset + 1.
这篇关于KafkaConsumer.commitAsync()行为的偏移量比以前的偏移量低的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!