As an introductory example, we will see how to use a future just for a simple operation: we will add two integers and use a future to run this operation asynchronously.
Using a future directly for a simple operation
Getting ready
To step through this recipe, we will need to import the Hello-Akka project; all other prerequisites are the same as before.
How to do it...
For this recipe, we will need to perform the following steps:
- Create a file, such as AddFuture.scala, in the com.packt.chapter4 package.
- Add the following imports to the top of the file:
import scala.concurrent.duration._
import...