首页 > 解决方案 > 在 OnException 块中访问骆驼交换对象

问题描述

                                          

  .onException(SocketTimeoutException.class,ConnectException.class)
            .handled(true)
            .maximumRedeliveries(5)
            .maximumRedeliveryDelay(5*1000)

我想使用交换对象属性值来配置 maximumRedeliveries 和 maximumRedeliveryDelay。

标签: apache-camel

解决方案


您可以使用retryWhileonException确定是否继续重试。您可以Exchange.REDELIVERY_DELAY在消息头中用作键来动态设置延迟。


推荐阅读