CronJob example

Say you want to have a batch job [1] launched periodically, you can use CronJob for this as follows:

   "id" : "cronjob-example",
   "name": "cronjob-example",
   "description": "This is a CronJob example",
   "action": {
       "actionName": "...",
       "typeName": "..."
   "concurrent": false,
   "inactive": false,
   "trackHistory": true,
   "scheduleDef" : {
       "cronExpression": "0/30 * * * * ?",
       "skipOverdue": true
   "inputs": {
       "param1": "...",
       "param2": "..."

Here is the explanation for the most important fields you need to fill in the json file above

  • action is used for defining what the cron job will trigger
    • typeName the type name, e.g. if you have JS Batch job then the action name will be JS
    • actionName the name of the method on the previous type that the cron job have to trigger, in our case batchJob
  • inputs a dictionary of parameter’s value by their name as expected by the action, e.g. "spec": {...}
  • cronExpression the expression used to control when the action will be scheduled, you can use a tool like this one [2] to help get a valid expression.
  • inactive a boolean flag to set the cron job to active / inactive

[1] JS Batch job example
[2] Cron Expression Generator