Pojo Component
The pojo: component binds PojoExchanges to method invocations on Java Objects.
URI format
Where someName can be any string to uniquely identify the endpoint
Using
Object instance that can receive invocations, must be explicitly registered with the PojoComponent.
PojoComponent component = (PojoComponent)camelContext.getComponent("pojo");
component.addService("bye", new SayService("Good Bye!"));
Once an endpoint has been registered, you can build Camel routes that use it to process exchanges.
camelContext.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:hello").to("pojo:bye");
}
});
A pojo: endpoint cannot be defined as the input to the route. Consider using a direct: or queue: endpoint as the input for a PojoExchange. You can use the createProxy() methods on PojoComponent to create a proxy that will generate PojoExchanges and send them to any endpoint:
Endpoint endpoint = camelContext.getEndpoint("direct:hello");
ISay proxy = PojoComponent.createProxy(endpoint, ISay.class);
String rc = proxy.say();
assertEquals("Good Bye!", rc);
See Also