0

我试图在我的路由中使用一个 onException 子句,其中也有一个聚合器。我期望每当在我的聚合器的 aggregate() 方法中引发异常时,OnException 子句应该捕获它、处理它并重新传递它。然而,这似乎并没有发生。谁能建议我哪里出错了。

from("jms:queue:start?concurrentConsumers=10").routeId("testRoute")
        .onException(Exception.class).log("Exception caught").process(new Processor() {

            @Override
            public void process(Exchange exchange) throws Exception {
                logger.debug("****Exception caught***");

            }
        })
        .handled(true).maximumRedeliveries(-1).end()
        .transacted()
        .aggregate(header("correlationHeader"), new CustomAggregator())
        .completionSize(50).
    to("jms:queue:end");

其中 CustomAggregator 是我的聚合器,在它的聚合方法中我抛出一个异常来测试我的异常处理。

任何帮助或建议表示赞赏。

4

0 回答 0