【问题标题】:Apache Camel- Message Redelivery happens before onexception block executesApache Camel-消息重新传递发生在一个异常块执行之前
【发布时间】:2016-02-11 16:02:31
【问题描述】:

有如下骆驼路线。

@Override
public void configure() throws Exception {

onException(java.lang.Exception.class).useOriginalMessage()
.beanRef("discoveryService", "updateConnection")
.redeliveryPolicyRef("redeliverMessagePolicy");

from(ENDPOINT_URI).to(queueName);
}

在 xml 中定义如下重新交付策略-

<redeliveryPolicyProfile id="redeliverMessagePolicy"
    retryAttemptedLogLevel="WARN" maximumRedeliveries="8"
    redeliveryDelay="${redeliveryDelay}" />

但是,当抛出异常时,会在 OnException 块执行之前进行重新传递尝试(一些配置属性在 onException 块中更新。在 OneException 内的 DiscoveryService 中有一个调试点,在重新传递尝试完成后调用它) .因此,当前消息会丢失而不会重新传递。不知道为什么会这样。 使用 activemq-camel 版本 5.8.0 谢谢

【问题讨论】:

    标签: java apache-camel activemq


    【解决方案1】:

    是的,这是有意的,onException 块仅在交换用尽时执行(例如,在所有重新交付尝试都失败后)。

    在文档中详细了解 Camel 中的错误处理是如何工作的

    如果你有 Camel in Action 这本书的副本,它有一整章专门介绍有关错误处理的所有内容(最完整的文档)

    如果您想在每次重新交付之前执行一些自定义逻辑,请使用onRedelivery 处理器:http://camel.apache.org/exception-clause.html

    【讨论】:

      猜你喜欢
      • 2018-12-16
      • 1970-01-01
      • 1970-01-01
      • 2015-10-19
      • 2017-04-07
      • 2019-02-10
      • 2020-09-22
      • 2015-06-07
      • 2012-09-15
      相关资源
      最近更新 更多