Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 conf
Octocat-spinner-32 public
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Procfile
Octocat-spinner-32 README.md
README.md

Simple Play 1.2.4 App with a Job

This little app shows how you can do simple one-off and scheduled jobs within Play 1.2.4 apps on Heroku. These jobs run in separate processes from the Play 1 web server.

Running Locally

export DATABASE_URL=postgres://f:f@localhost/f
play start --%prod
java -Dapplication.path=. -Dplay.id=prod -DlogLevel=INFO -Dprecompiled=true -cp lib/*:conf:~/play-1.2.4/framework/play-1.2.4.jar:~/play-1.2.4/framework/lib/*:tmp/classes jobs.HelloJob .

Running on Heroku

Clone this project locally:

$ git clone git://github.com/jamesward/play1-scheduled-job-demo

In the play1-scheduled-job-demo directory, create a new app on Heroku (make sure you have the Heroku Toolbelt installed):

$ heroku login
$ heroku create

Push the app to Heroku:

git push heroku master

Verify that it works:

heroku open

Run a one-off HelloJob:

heroku run hello

Add the Scheduler add-on:

heroku addons:add scheduler:standard

Open the Scheduler add-on console:

heroku addons:open scheduler

Add a new scheduled task with hello as the command / task name. Set the desired frequency. Save the scheduled task and either wait for it to run or manually run it from the Scheduler add-on console.

Something went wrong with that request. Please try again.