KafkaConsumer.commitAsync() 行为的偏移量比以前的低 [英] KafkaConsumer.commitAsync() behavior with a lower offset than previous

查看:34
本文介绍了KafkaConsumer.commitAsync() 行为的偏移量比以前的低的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

kafka 将如何处理调用

How will kafka deal with a call to

KafkaConsumer.commitAsync(Map 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆