Giter VIP home page Giter VIP logo

wcron's Introduction

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

wcron's People

Contributors

giosil avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.