Skip to content

giosil/wcron

Repository files navigation

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

About

A job scheduler configurable through RESTful web services.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy