Where is the job support in Play 2.0?

后端 未结 3 872
春和景丽
春和景丽 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条回答
  •  没有蜡笔的小新
    2020-12-03 08:30

    Fixed the links in original accepted answer which posted by JonasAnso

    To obtain the functionality of OnApplicationStart you can use Global onStart

    • https://www.playframework.com/documentation/2.4.x/api/scala/index.html#play.api.GlobalSettings
    • https://www.playframework.com/documentation/2.4.x/api/java/play/GlobalSettings.html

    Here you can schedule your actors using Akka.

    • https://www.playframework.com/documentation/2.4.x/ScalaAkka
    • https://www.playframework.com/documentation/2.4.x/JavaAkka

    Hope it helps.

提交回复
热议问题