views:

41

answers:

1

I'd like to setup a spring bean (either via interface or bean class). that I can call to "start" a Route.

In this simple example when I call sayHello("world") from code I'd like it to route the return value of the sayHello method the endpoint that will write it out to a file.

Does anyone know if this is possible, or how to go about this? I know I can expose that same interface via CXF and make this work, but I really just want to call a method, not go through the trouble of sending a jms message or calling a webservice.

public interface Hello{
   public String sayHello(String value);
}

from("bean:helloBean").to("file:/data/outbox?fileName=hello.txt");
+2  A: 

Yes you can use proxy/remoting in Camel to do this.

Then when you invoke sayHello(value) the value is being routed to the chosen route. And the reply from the route is returned from the sayHello method.

See these links
- http://camel.apache.org/spring-remoting.html
- http://camel.apache.org/hiding-middleware.html
- http://camel.apache.org/using-camelproxy.html

Chapter 14 of the Camel in Action book covers this in much more detail: http://www.manning.com/ibsen

Claus Ibsen
Thanks for answering my question. I guess I need to get an update to my MEAP book. For Chapter 14 it says TBD. The book has been very helpful though!
ScArcher2