AdviceWithPage edited by Claus IbsenChanges (3)
Full ContentAdviceWithAvailable as of Camel 2.1 AdviceWith is used for testing Camel routes where you can advice an existing route before its being tested. What adviceWith allows is to changes some factors on the route before the test is being run. At current time you can advice an existing route by adding Intercept, Exception Clause etc. which then will apply for the route being advice. For example in the route below we intercept sending a message to the mock:foo endpoint and detour the message. public void testAdvised() throws Exception { // advice the first route using the inlined route builder context.getRouteDefinitions().get(0).adviceWith(context, new RouteBuilder() { @Override public void configure() throws Exception { // intercept sending to mock:foo and do something else interceptSendToEndpoint("mock:foo") .skipSendToOriginalEndpoint() .to("log:foo") .to("mock:advised"); } }); getMockEndpoint("mock:foo").expectedMessageCount(0); getMockEndpoint("mock:advised").expectedMessageCount(1); getMockEndpoint("mock:result").expectedMessageCount(1); template.sendBody("direct:start", "Hello World"); assertMockEndpointsSatisfied(); } Using AdviceWithRouteBuilderAvailable as of Camel 2.7 The AdviceWithRouteBuilder is a specialized RouteBuilder which has additional methods for advising routes. For example this allows you to manipulate the advised route, such as replacing a node with some other nodes. The AdviceWithRouteBuilder offers the following extra methods
The pattern option is used for matching. It uses the same rules as the Intercept, which is applied in the following order:
For example to match exact you can use adviceBy("foo") which will match only the id in the route which has the value "foo".
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache Camel > AdviceWith confluence
- [CONF] Apache Camel > AdviceWith confluence
- [CONF] Apache Camel > AdviceWith confluence
- [CONF] Apache Camel > AdviceWith confluence
- [CONF] Apache Camel > AdviceWith confluence
- [CONF] Apache Camel > AdviceWith confluence
- [CONF] Apache Camel > AdviceWith confluence
- [CONF] Apache Camel > AdviceWith confluence