spring-retry :“上次尝试后重试已耗尽,没有恢复路径”不可重试方法的原始异常
我正在尝试在我的 Spring Boot 应用程序中实现 spring-retry(版本 - 1.3.1)。如果在第一个请求中找不到记录,我必须重试 Web 服务操作来读取记录。
示例代码:
@Retryable(include = {IllegalArgumentException.class}, backoff = @Backoff(500), maxAttempts = 3, recover ="readFallback")
Object read(String Id);
@Recover
Object readFallback(RuntimeException e, String Id);
void deletePayment(String paymentId);
问题: 在异常情况下,我从读取方法(用 @Retryable
注释)中得到正确的响应,但当我在删除方法上遇到异常时,我得到带有嵌套原始异常的 RetryExhaustedException
。如您所见,删除方法没有用 @Retryable
注释。删除方法在不同的包中。
**异常响应示例 **:“上次尝试后重试已用尽,没有恢复路径;嵌套异常为异常。NotFoundException:未找到”
预期:删除方法不应受到 @Retryable 的影响
。有人可以帮我找出我错过了什么或做错了什么吗?我已经尝试过,但无法在互联网上找到这个问题的解决方案。
提前致谢 !
I am trying to implement spring-retry(version - 1.3.1) in my spring boot application. I have to retry webservice operation to read the record if not found in first request.
sample code:
@Retryable(include = {IllegalArgumentException.class}, backoff = @Backoff(500), maxAttempts = 3, recover ="readFallback")
Object read(String Id);
@Recover
Object readFallback(RuntimeException e, String Id);
void deletePayment(String paymentId);
Problem :
I am getting correct response from read method(annotated with @Retryable
) in exception scenario but I am getting RetryExhaustedException
with nested original exception when I am getting exception on my delete method. As you see, delete method doesn't annotated with @Retryable
. Delete method is in different package.
**Sample exception response ** : "Retry exhausted after last attempt with no recovery path; nested exception is exception.NotFoundException: Not found"
Expected : Delete method should not be impacted by @Retryable
. Can someone help me to find what am i missing or doing wrong. I have tried but unable to not found the solution of this problem on internet.
Thanks in advance !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
按我的预期工作:
请提供一个 MCRE 来展示您所看到的行为,以便我们了解问题所在。
Works as expected for me:
Please provide an MCRE that exhibits the behavior you see so we can see what's wrong.