英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论