Custom Scheduled Jobs Overview

 

Custom Scheduled Jobs are a powerful tool that allow users to automatically invoke a specific operation on a regular schedule without human interaction.

Currently, users can define custom scheduled jobs to invoke the following operations:

For a list of currently supported batch jobs, their ids, and parameters, see the batch job reference table.

For a full definition of custom scheduled job endpoints (how to create them, trigger, them, etc) see Custom Scheduled Job Endpoints.

Example

 

Custom Scheduled Jobs can be a powerful tool to run system level work on a periodic basis.

If new search parameters are added monthly, it might be helpful to run a REINDEX job periodically.

For example:

POST http://localhost:9000/scheduled-job
{
	"nodeId": "Master",
	"moduleId": "persistence",
	"scheduledJobId": "my-reindex-job",
	"schedule": "0 0 0 1 * ?",
	"target": "batch:REINDEX",
	"active": true,
	"parameters": "{}",
	"schedulerType": "CLUSTERED"
}

This would create a custom scheduled job that will run the batch REINDEX job on the first of every month at midnight.

Permissions

 

Because custom scheduled jobs are run at a system level, and because batch jobs and camel routes can touch many resources, permissions to create, edit, delete, or even triggering custom scheduled jobs are considered extremely powerful and should not be granted lightly.

Because the module Id is considered part of the 'target' of the scheduled job, permissions are at the highest level, and not per-module.

  • CREATE_ANY_SCHEDULED_JOB - Grants the ability to create any custom scheduled job for any target on any module.
  • UPDATE_ANY_SCHEDULED_JOB - Grants the ability to update any existing custom scheduled job for any target on any module.
  • DELETE_ANY_SCHEDULED_JOB - Grants the ability to delete any existing custom scheduled job for any target on any module.
  • TRIGGER_ANY_SCHEDULED_JOB - Grants the ability to trigger an existing custom scheduled job immediately without waiting for the scheduled time.
  • READ_ANY_SCHEDULED_JOB - Grants the ability to view any custom scheduled job on any module for any target.

In addition to these permissions, there is also the slightly weaker permission READ_ANY_SCHEDULED_JOB_HISTORY which grants the ability to view the history (execution outcomes) of the custom scheduled jobs. This permission is automatically included with any of the above permissions.