0

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...

Mourish Khan
  • 131
  • 4

1 Answers1

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