...
Method | Description |
---|---|
| Is used to easily mock all endpoints. See more details and examples at Mock. |
| Is used to easily mock endpoints using a pattern. See more details and examples at Mock. See below for pattern matching. |
| Is used to select node(s) matching by id's, and weave in the following nodes. See below for pattern matching and examples. |
| Is used to select nodes(s) matching by their |
| Camel 2.8: Is used to select node(s) matching by their class type (the classes from the org.apache.camel.model package), and weave in the following nodes. See below for examples. |
| Camel 2.8: Is a short hand to easily weave in the following nodes in the start of the route. |
| Camel 2.8: Is a short hand to easily weave in the following nodes in the end of the route. |
| Camel 2.9: To replace the route input to a new endpoint uri. |
The pattern
option is used for matching. It uses the same rules as the Intercept, which is applied in the following order:
...
Code Block |
---|
context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
weaveAddFirst().to("mock:input");
weaveAddLast().to("mock:output");
}
});
|
Replace from
Available as of Camel 2.9
You may have routes which consumes messages from endpoints which you want to substitute with another endpoint for easier unit testing. For example a JMS endpoint could be replaced with a SEDA or Direct for unit testing a route, as shown below where we replace the input of the route to a "seda:foo" endpoint:
Code Block |
---|
context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
replaceFrom("seda:foo");
}
});
|