一:背景
手动poll kafka消息,并且手动提交; 运行的时候,偶尔(频次比较低)会出现如下错误:
org.apache.kafka.clients.consumer.RetriableCommitFailedException: Offset commit failed with a retriable exception. You should retry committing offsets.
The underlying error was: null 。
二:主要是这段代码
consumer.commitAsync(new OffsetCommitCallback() {
@Override
public void onComplete(Map<TopicPartition, OffsetAndMetadata> offsets,
Exception exception) {
if (exception != null) {
LOG.error("【kafka数据迁移】kafka数据commit失败,offset:{},error:{}",offsets,exception);
}
}
});