I working on a test that sets up a CXF REST endpoint and then routes the request to various beans depending on the operation. I'm trying to include a log entry after the choice statement that sends the request to the beans to log what the response looks like. Source code:

@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        @Override
        public void configure() {
            from("cxfrs://local://rest?resourceClasses=com.company.FooService")
                .setExchangePattern(ExchangePattern.InOut)
                .to("log:com.company.foo?level=INFO&showAll=true")
                .choice()
                    .when(header("operationName").isEqualTo("opA"))
                        .to("bean:beanA")
                    .when(header("operationName").isEqualTo("opB"))
                        .to("bean:beanB")
                    .otherwise()
                        .log("Bad operation")
                .endChoice()
                .to("log:com.company.foo?level=INFO&showAll=true")
        }
    };
}

My issue is that only the first .to("log.... statement seems to be executed. Any idea what I'm doing wrong?

Version detail: Camel 2.12.2, CXF 2.7.7, Java 1.7.0_45

Thanks,
-Chris

Reply via email to