I couldn't get the forums to come up, it keeps timing out, so I have to
ask this question on the mailing list.
I have two Pojo endpoints, and I want to route based on a String input.
How do I do that? This is my code currently:
CamelContext context = new DefaultCamelContext();
PojoComponent component1 = (PojoComponent)
context.getComponent("pojo");
component1.addService("one", new PojoOne());
PojoComponent component2 = (PojoComponent)
context.getComponent("pojo");
component2.addService("two", new PojoTwo());
DirectComponent directComponent =
(DirectComponent) context
.getComponent("direct");
directComponent.createEndpoint("hello");
context.addRoutes(new RouteBuilder() {
public void configure() {
FromBuilder from =
from("direct:hello");
ChoiceBuilder choice =
from.choice();
WhenBuilder when =
choice
.when(body().isEqualTo("One"));
when.to("pojo:one")
.otherwise().to("pojo:two");
}
});
context.start();
Endpoint endpoint =
context.getEndpoint("direct:hello");
PojoNumInterface pojo = (PojoNumInterface)
PojoComponent.createProxy(
endpoint,
PojoNumInterface.class);
pojo.execute("One");
I'm guessing the body() function only returns a PojoInvocation and not
the actual argument "One".
Roshan