基于内容的路由问题

时间:2017-06-22 21:58:34

标签: java apache-camel placeholder

您好我正在尝试根据标头值

路由到两个不同的速度模板文件
public void configure() throws Exception {
    from("direct:csi:aaa").bean(bbb.class, "transform").wireTap("direct:auditlog:request").choice()
            .when().simple("${in.header.ccc == 'true'}").to("velocity:vm/ddd.vm").otherwise()
            .to("velocity:vm/eee.vm").end().to("http4://headeruri?throwExceptionOnFailure=false")
            .convertBodyTo(String.class).wireTap("direct:auditlog:response")
            .bean(bbb.class, "processResponse").routeId("zzzRouteBuilder");
}

交换机在标题中有 ccc ,它是真的,但仍然是eee.vm

1 个答案:

答案 0 :(得分:2)

简单定义中存在错误,应该是:

.when().simple("${in.header.ccc} == 'true'")

或者更简单:

.when().simple("${in.header.ccc}")
相关问题