一旦消息被消费或处理,我如何准确地从 Kafka 获得确认。听起来可能很愚蠢,但是有什么方法可以知道收到 ack 的消息的开始和结束偏移量吗?
最佳答案
到目前为止,我发现的是在 0.8 中,他们引入了以下方法来从偏移量中进行选择以进行读取 ..
kafka.api.OffsetRequest.EarliestTime() finds the beginning of the data in the logs and starts streaming from there, kafka.api.OffsetRequest.LatestTime() will only stream new messages.
示例代码
https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example
仍然不确定确认部分
关于apache-kafka - 如何获得 Kafka 的确认,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17963833/