There are some situations where we want an operation to occur at a specified time or occur repeatedly after an interval. This is like a cron job. Let's go through the recipe.
Scheduling an operation at a specified interval
Getting ready
To step through this recipe, we need to import our Hello-Akka project into the IDE and create a com.packt.chapter5 package in which we will put all the code.
How to do it...
- Let's create a file, say, ScheduleOperation.scala in the com.packt.chapter5 package.
- Add the following imports to the top of the file:
import akka.actor.ActorSystem
import...