I have a route dispatching an exchange according to a XPath evaluation to
different targets.
Sadly it doesnt perform very well. I think that the DOM is built for every
XPath evalutation.
Is it true? Can we configure Camel to reuse the DOM?
I think in this Route Camel builds the same DOM 4 times.
public class MyRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
Namespaces v1 = new Namespaces("v1", "...");
Namespaces v2 = new Namespaces("v2", "...");
from("direct:dispatcher")
.id("dispatcher")
.choice()
.when().xpath("/v1:TypeA",
v1).to("bean:beanA?method=execute")
.when().xpath("/v1:TypeB",
v1).to("bean:beanB?method=execute")
.when().xpath("/v2:TypeA",
v2).to("bean:beanC?method=execute")
.when().xpath("/v2:TypeB",
v2).to("bean:beanD?method=execute")
// many more when().xpath().to() statements
.end();
}
}
Jan