且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

KafkaConsumer.commitAsync() 行为的偏移量比以前的低

更新时间:2021-12-11 21:37:29

它会简单地将分区的偏移量设置为您指定的值,因此下次您将使用来自 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.