首页 > 其他分享 >librdkafka auto.offset.reset 解释

librdkafka auto.offset.reset 解释

时间:2023-01-09 17:56:21浏览次数:49  
标签:reset 消费 auto offset librdkafka largest earliest latest

 

官网解释:

Action to take when there is no initial offset in offset store or the desired offset is out of range: 'smallest','earliest' - automatically reset the offset to the smallest offset, 'largest','latest' - automatically reset the offset to the largest offset, 'error' - trigger an error which is retrieved by consuming messages and checking 'message->err'.
Type: enum value

这个解释,不是很好理解:

我在这里翻译成自己的理解

如果消费端未向服务端提交过位点:

  • earliest:从头消费
  • latest/largest从新产生的数据开始消费【验证方法,建立连接后,让生产方生产数据】

如果消费端已经向服务端提交过位点:

  • earliest和latest表现一致,从上次提交的offset开始消费

 

 

参考文档:https://blog.csdn.net/lishuangzhe7047/article/details/74530417

标签:reset,消费,auto,offset,librdkafka,largest,earliest,latest
From: https://www.cnblogs.com/guoliushui/p/17037759.html

相关文章