Scheduler for running command on timer.
- Apache Phoenix
- MySQL
- Java 8
mvn clean package
- MySQL setting
- Concurrent setting
- web.WebApi
Post request to start a job to /job
Currently, only Shell
or Apache Phoenix SQL
are supported.
- Define the variable
${variable_name}
, you can use it later. - Chain the jobs. e.g.
- We define a task which first running at 15.p.m., run every 5 minutes,
- Get the last date.
- select the count from some table where date = yesterday.
- upsert the result into some other table.
{
"starttime":900,
"freq":5,
"category":"shell_test",
"tasks":[
{
"jobType":"shell",
"command":"date -v-1d +%F",
"outputs":["yesterday"]
},
{
"jobType":"phoenix",
"jdbc":"jdbc:phoenix:zk1:2181",
"sql":"select count(1) as countN from TABLE_TEST where date = '${yesterday}';",
"outputs":["countN"]
},
{
"jobType":"phoenix",
"jdbc":"jdbc:phoenix:zk1:2181",
"sql":"upsert into RESULT_TEST values('${yesterday}_${countN}','${countN}','${yesterday}')",
"outputs":[]
}
]
}
It will be scheduled to run as you want.
URI | Method | detail |
---|---|---|
/jobs | Get | Return all the accepted jobs |
/job | Post | Post a json into it, return a jobId. |
job/jobId | Get | Get the job with jobId |
job/jobId | Delete | Delete the job with jobId |
job/category | Get | Get the jobs with the category |
job/category | Delete | Delete the jobs with the category |
For more usage, you may get a lot to do. like:
- Monitor some database.
- Refresh some setting.
- Put some data into Apache Kafka, if Kafka Actor is implemented.
- ...
- Akka to Akka Remote/Cluster for HA
- support more job type
- More Unit test