Hello,
Basically, I just want to 'cast' my Future<Object> to a Future<Response> using the following code:
import akka.dispatch.Future;
import akka.japi.Function;
import akka.pattern.Patterns;
final Future<Object> wrappedFuture = Patterns.ask(matchedHandler, message, handleCommandTimeout);
final Future<Response> responseFuture = wrappedFuture.map(new Function<Object,Response>() {
public Response apply(Object source) {
Response response = null;
if(source instanceof Response){
response = (Response) source;
}
return response;
});
The problem is that this doesn't compile.
The method map(Function1<Object,A>) in the type Future<Object> is not applicable for the arguments (new Function<Object,Response>(){})
Any idea how I should use the Future.map function?
Thanks!