May 2017
Intermediate to advanced
414 pages
13h
English
In this recipe, we are using future as we have used it in other places. The only difference is that we got ExecutionContext by importing context.dispatcher inside the actor, which is a default disptacher in Akka.
Here, we are using Await.result to retrieve a result from the future, and it blocks the thread inside the actor, which is not recommended. Instead, we should use a callback function, such as onComplete.
After you run the preceding application, its output will be as follows:
Future result is 30
Read now
Unlock full access