Search code examples
javagoogle-app-enginegoogle-cloud-platformapp-engine-flexible

How do you schedule a Java Task (cron) on app engine flexible?


How do you create a Java long running scheduled task (like every hour) on app engine flexible environment?

The only docs I can find are for standard environment: https://cloud.google.com/appengine/docs/standard/java/config/cron

Is there anything in the platform?


Solution

  • Yes, it does. Documentation is here for Flexible/Java.

    To upload your cron jobs, you must specify the cron.yaml as a parameter to the following gcloud command:

    gcloud app deploy cron.yaml
    

    To delete all cron jobs, change the cron.yaml file to just contain:

    cron:
    

    The cron.yaml file lives in the WEB-INF directory of your application (alongside app.yaml). The following is an example cron.yaml file:

    cron:
    - description: daily summary job
      url: /tasks/summary
      schedule: every 24 hours