Camel Splitter Aggregator需要虚拟语句

时间:2015-05-25 01:11:08

标签: apache-camel

在camel(2.14)中使用split / aggregator时,会引发异常:

@Override
public void configure() throws Exception {
    from("timer://foo?repeatCount=1")
    .bean(someBean)
    .split(body(), new MyAgg())  
    .end()
    .bean(printBean);
} 

Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> Split[{body} -> []] <<< in route: Route(route1)[[From[timer://foo?repeatCount=1]] -> [Bean[org... because of Definition has no children on Split[{body} -> []]

以下工作正常:

@Override
public void configure() throws Exception {
    from("timer://foo?repeatCount=1")
        .bean(someBean)
        .split(body(), new MyAgg())  
        .log("blah blah")
        .end()
        .bean(printBean);
} 

someBean在交换中设置String列表。 printBean在最后打印出交换。 MyAgg附加来自交换的字符串。

第二个选项中的日志语句似乎是多余的。有没有选项让第一个选项有效?

0 个答案:

没有答案