In Play 1.0, we can define some jobs which will be executed in the background:
@OnApplicatonStart
@Every("1h")
public class DataJob extends Job {
public void doJob() {
// ...
}
}
But I can't find it in Play 2.0. Do I miss something?
For the acutal job part this seems to be the way in Java,
You could use the scheduler service in akka.
http://doc.akka.io/docs/akka/2.0/java/scheduler.html
http://doc.akka.io/docs/akka/2.0/scala/scheduler.html
Basically you create an actor that executes your logic if it receives a certain message.
Fixed the links in original accepted answer which posted by JonasAnso
To obtain the functionality of OnApplicationStart you can use Global onStart
Here you can schedule your actors using Akka.
Hope it helps.