A job scheduler configurable through RESTful web services. The scheduler contains the following entities:
- Activity: identified by name specifies the class that will perform the task and the default execution parameters;
- Job: specifies acitivity schedulation with the optional execution parameters.
The class is identified by Activity.uri as follows:
- mock: no-action job;
- package.ClassName: class in {user.home}/wcron/classes;
- java:global/[application]/[module]/EJBName: JNDI lookup name of EJB.
git clone https://github.com/giosil/wcron.git
mvn clean install
docker build -t wcron .
- this will create a Docker image named wcrondocker run --rm -it -p 8080:8080 wcron
- To run image named wcron
Access to RESTful services is through HTTP basic authentication.
For test use dev:dev.
Get application info.
Request:
GET http://localhost:8080/wcron/scheduler/manager/info
Response:
HTTP 200 OK
object
Example response:
{"name":"wcron","version":"1.0.6","activities":1,"jobs":1}
Get list of activities.
Request:
GET http://localhost:8080/wcron/scheduler/manager/listActivities
Response:
HTTP 200 OK
array[object]
Example response:
[{"name":"demo","uri":"mock","parameters":{"greeting":"hello"},"createdAt":1584313200000}]
Get list of activity name available.
Request:
GET http://localhost:8080/wcron/scheduler/manager/getActivityNames
Response:
HTTP 200 OK
array[string]
Example response:
["demo"]
Define an activity.
Request:
POST http://localhost:8080/wcron/scheduler/manager/addActivity
object
Request example:
{"name":"test", "uri":"test.JobTest", "parameters":{"greeting":"hello"}}
Response:
HTTP 200 OK
boolean
Delete an activity.
Request:
GET http://localhost:8080/wcron/scheduler/manager/removeActivity/{activityName}
Response:
HTTP 200 OK
boolean
Get list of scheduled jobs.
Request:
GET http://localhost:8080/wcron/scheduler/manager/listJobs
Response:
HTTP 200 OK
array[object]
Response example:
[{"id":1,"activity":{"name":"demo","uri":"mock","parameters":{"greeting":"hello"},"createdAt":1584313200000},"expression":"1000 5000","parameters":null,"running":false,"requestInterrupt":false,"lastResult":"1584455410924","lastError":"","createdAt":1584313200000,"elapsed":1}]
Schedule a job.
Request:
GET http://localhost:8080/wcron/scheduler/manager/schedule/{activityName}/{expression}
Response:
HTTP 200 OK
integer
(jobId)
Schedule a job.
Request:
POST http://localhost:8080/wcron/scheduler/manager/schedule/{activityName}/{expression}
object
Request example:
{"greeting": "hello"}
Response:
HTTP 200 OK
integer
(jobId)
Delete a job.
Request:
GET http://localhost:8080/wcron/scheduler/manager/removeJob/{jobId}
Response:
HTTP 200 OK
boolean
Get job info.
Request:
GET http://localhost:8080/wcron/scheduler/manager/getJob/{jobId}
Response:
HTTP 200 OK
object
Example response:
{"id":1,"activity":{"name":"demo","uri":"mock","parameters":{"greeting":"hello"},"createdAt":1584313200000},"expression":"1000 5000","parameters":null,"running":false,"requestInterrupt":false,"lastResult":"1584455850925","lastError":"","createdAt":1584313200000,"elapsed":1}
Response if not found:
HTTP 404 Not found
Clean output folder.
Request:
GET http://localhost:8080/wcron/scheduler/manager/clean
Response:
HTTP 200 OK
boolean