ConsumerRecordRecoverer在SeekToCurrentErrorHandler中抛出异常时会发生什么情况?

huangapple go评论57阅读模式
英文:

What happens if ConsumerRecordRecoverer in SeekToCurrentErrorHandler throws exception

问题

ConsumerRecordRecoverer在SeekToCurrentErrorHandler中抛出异常会怎么样?我看了代码,根据我的理解,如果发生这种情况,记录会被重新播放。我的理解正确吗?

有没有更好的处理方法?比如在恢复失败时捕获特定异常,记录日志并捕获度量数据,然后继续进行?

英文:

I am just wondering what if ConsumerRecordRecoverer in SeekToCurrentErrorHandler throws exception? I saw the code and according to my understanding if this happens the record will replayed again. Is my understanding right?

Is there a way to better handle this? Like catching that specific exception when recoverer fails and logging that and capturing that metrics and move on?

答案1

得分: 1

你的理解是正确的;框架在这里不能做任何假设,因此,如果恢复程序无法“恢复”记录并重新播放,则采用保守的方法。

在许多情况下(例如,无法将失败发布到死信主题),这将是期望的行为。

如果这不是你想要的,你需要将逻辑放在恢复程序中。

英文:

Your understanding is correct; the framework can't make any assumptions here so it takes the conservative approach if the recoverer fails to "recover" the record and it is replayed.

In many cases (e.g. failure to publish the failure to a dead letter topic) this would be the desired behavior.

If that's not what you want, you need to put the logic in the recoverer.

huangapple
  • 本文由 发表于 2020年1月6日 17:33:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/59609645.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定