https://github.com/giosil/wcron
A job scheduler configurable through RESTful web services.
https://github.com/giosil/wcron
cron java java-rest-api java-restful java-scheduler javaee scheduler
Last synced: 6 months ago
JSON representation
A job scheduler configurable through RESTful web services.
- Host: GitHub
- URL: https://github.com/giosil/wcron
- Owner: giosil
- License: apache-2.0
- Created: 2020-03-10T16:59:11.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-31T14:15:22.000Z (over 1 year ago)
- Last Synced: 2024-12-27T11:44:15.489Z (about 1 year ago)
- Topics: cron, java, java-rest-api, java-restful, java-scheduler, javaee, scheduler
- Language: Java
- Homepage:
- Size: 2.39 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WCron
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.
## Build
- `git clone https://github.com/giosil/wcron.git`
- `mvn clean install`
- `docker build -t wcron .` - this will create a Docker image named wcron
- `docker run --rm -it -p 8080:8080 wcron` - To run image named wcron
## API
Access to RESTful services is through HTTP basic authentication.
For test use dev:dev.
### Info
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}`
### listActivities
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}]`
### getActivityNames
Get list of activity name available.
Request:
**GET** `http://localhost:8080/wcron/scheduler/manager/getActivityNames`
Response:
HTTP 200 OK
`array[string]`
Example response:
`["demo"]`
### addActivity
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`
### removeActivity (by activityName)
Delete an activity.
Request:
**GET** `http://localhost:8080/wcron/scheduler/manager/removeActivity/{activityName}`
Response:
HTTP 200 OK
`boolean`
### listJobs
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 (without execution parameters)
Schedule a job.
Request:
**GET** `http://localhost:8080/wcron/scheduler/manager/schedule/{activityName}/{expression}`
Response:
HTTP 200 OK
`integer` *(jobId)*
### schedule (with execution parameters)
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)*
### removeJob
Delete a job.
Request:
**GET** `http://localhost:8080/wcron/scheduler/manager/removeJob/{jobId}`
Response:
HTTP 200 OK
`boolean`
### getJob
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
Clean output folder.
Request:
**GET** `http://localhost:8080/wcron/scheduler/manager/clean`
Response:
HTTP 200 OK
`boolean`
## Contributors
* [Giorgio Silvestris](https://github.com/giosil)