We just start testing Play!Framework and akka, for use it in our
future projects.
-
We would like to know how to make an asynchronous call from an
Action in the Controller of PLAY![2.0] to an Actor in Akka. We have
seen examples in the scala API but no examples in java API. -
To make asynchronous requests, we believe that we must to use the
class play.libs.WS and play.libs.F.Promise but these do not appear in
play_2.9.1.jar they only appear in the API (https://github.com/playframework/Play20/tree/master/framework/src/play/src/main/java/play/libs)
Thanks in advance.
You’re mixing things a little up.
play.libs.WS is for webservice requests (requests to certain urls).
play.libs.F.Promise is (afaik) just a relict from Play 1.x
To use a actor, instantiate a ActorSystem, then create a actor
and send a message to him. If you “ask” ( actor.ask(…) ) for a result,
you can use Await.(don’t know the exact name right now, use source completion of your IDE) to wait for its response.