Iam new to play scala, My use case is run a function every 3 seconds and (Every 3 seconds i check MySQL DB, i get a particular value means proceed to next step). any other possibilities to do...
Asked
Active
Viewed 238 times
1 Answers
3
You should inject Akka ActorSystem
in your class and schedule a job with it, like:
import play.api.libs.concurrent.Execution.Implicits.defaultContext
// ...
system.scheduler.scheduleOnce(10.milliseconds) {
file.delete()
}
This code is taken from the Play docs, you should read them. For more complicated tasks use Actors, of course.

insan-e
- 3,883
- 3
- 18
- 43
-
If you're already injecting the `ActorSystem` you may as well inject the ExecutionContext. – rethab Jul 19 '16 at 09:28