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?
Play Framework is an open-source web application framework which follows the model–view–controller (MVC) architectural pattern. It is written in Scala and usable from other programming languages that are compiled to JVM bytecode, e.g. Java.
Play is rock-solid and used by hundreds of thousands of Java and Scala developers every month. Play is still extremely relevant to today's application and web development and has a passionate and very capable community around it ensuring that it has many good years left.
Play Framework makes it easy to build web applications with Java & Scala. Play is based on a lightweight, stateless, web-friendly architecture. Built on Akka, Play provides predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With