The point is, I don't want to use any Camel APIs in my application code,
all my service clients and service implementations are Bean endpoints,
and all the Camel plumbing should happen in the Spring Configuration.
Example:
public interface Calculator {
// long running implementation
Future<Integer> add(int a, int b);
}
public class CalculatorClient {
@Inject
private Calculator calculatorProxy;
public void calculate() {
// returns immediately
Future<Integer> sum = calculatorProxy.add(2, 3);
// do something else
Integer theSum = sum.get();
System.out.println(sum);
}
So the ProducerTemplate and the Future API won't help at all. I'm
currently trying to create my own FutureComponent, derived from
SedaComponent, which will allow me to use routes like
from("bean:calcClient").to("future:calc").to("bean:calcImpl")
or in a client-server scenario with JMS in between:
// Client VM
from("bean:calcClient").to("future:calc").to("jms:queue:calc")
// Server VM
from("jms:queue:calc").to("bean:calcImpl")
I can't help feeling there must be an easier way of doing this, but I
just don't see how...
Best regards,
Harald
Am 16.03.2011 08:24, schrieb Willem Jiang:
If you are write your own component, you can use the camel async API[1]
to do work asynchronously.
But as you are using the client API to send the request into the camel
route, you need to leverage the Feature API[2]
[1]http://camel.apache.org/asynchronous-processing.html
[2]http://camel.apache.org/async.html