The camel docs advise not to use adviceWith multiple times in the same
route, but say that it's OK to use it across multiple routes. However, I'm
seeing problems with the latter. If I use the following in my test...

        context.getRouteDefinition("route1").adviceWith(context, new
AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("cxf:bean:foo?dataFormat=PAYLOAD")
                        .skipSendToOriginalEndpoint()
                        .transform(constant(someXml))
                        .process(exchange -> log.info("FOO CXF GOT
INTERCEPTED."))
                        .to("mock:foo");
            }
        });

        context.getRouteDefinition("route2").adviceWith(context, new
AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("cxf:bean:bar?dataFormat=PAYLOAD")
                        .skipSendToOriginalEndpoint()
                        .transform(constant(someXml))
                        .process(exchange -> log.info("BAR CXF GOT
INTERCEPTED."))
                        .to("mock:bar");
            }
        });

...the "bar" interceptor never gets hit, but the "foo" one does. If I
comment out the "foo" one, the "bar" one DOES get hit.

It also doesn't actually seem to matter which route I apply adviceWith
against - I get the same behavior regardless. Any thoughts? I'm using
2.17.0.

Jeff

Reply via email to