Where is the job support in Play 2.0?

后端 未结 3 867
春和景丽
春和景丽 2020-12-03 08:06

In Play 1.0, we can define some jobs which will be executed in the background:

@OnApplicatonStart
@Every(\"1h\")
public class DataJob extends Job {
    publi         


        
3条回答
  •  猫巷女王i
    2020-12-03 08:31

    For the acutal job part this seems to be the way in Java,

    Akka.system().scheduler().schedule(
            Duration.create(0, MILLISECONDS),   // initial delay 
            Duration.create(5, MINUTES),        // run job every 5 minutes
    
            new Runnable() 
            {
                public void run() 
                {
                    ....
                }
            }
        );
    

提交回复
热议问题