骆驼的最大收益被忽略

发布于 2025-02-03 07:05:15 字数 644 浏览 3 评论 0原文

我尝试使用骆驼将文件从一个文件夹传递到一个rest调用,然后我试图在错误中实现这一目标,它试图重新装订两次,然后如果第二个重新播放也会失败,则将其移至错误文件夹。我的代码在RouteBuilder的配置方法中看起来像这样:

errorHandler(deadLetterChannel("file:///home/camelerror").useOriginalMessage());

        from("file:///home/camelefiles")
                .onException(RetryableException.class)
                .log("RetryableException handled")
                .maximumRedeliveries(2)
                .end()
                .routeId(port.id())
                .throwException(new RetryableException());

我得到了“ Retryable Exception处理”日志,因此我猜该异常已正确处理,但它将消息重新列出了无限的次数。 我在做什么错,如何才能实现该消息仅两次重新传递,然后使用deadletternernel?

I try to use Camel to deliver files from one folder to a rest call and Im trying to achieve that on Error it's tried to redeliver twice and then moved to an error folder if the second redelivery fails as well. My code in the RouteBuilder's configure method looks like this:

errorHandler(deadLetterChannel("file:///home/camelerror").useOriginalMessage());

        from("file:///home/camelefiles")
                .onException(RetryableException.class)
                .log("RetryableException handled")
                .maximumRedeliveries(2)
                .end()
                .routeId(port.id())
                .throwException(new RetryableException());

I get the "RetryableException handled" logs so I guess the exception is handled correctly but it redelivers the message an infinite number of times.
What am I doing wrong and how can I achieve that the message is only redelivered twice and then the deadLetterChannel is used?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文