Schedules are configured through JSON objects. The schedule configuration involves two types of files:
-
The
openidm/conf/scheduler.jsonfile, that configures the overall scheduler service -
One
openidm/conf/schedule-file for each configured scheduleschedule-name.json
The scheduler service configuration file
(openidm/conf/scheduler.json) governs the configuration
for a specific scheduler instance, and has the following format:
{
"threadPool" : {
"threadCount" : "10"
},
"scheduler" : {
"instanceId" : "scheduler-example",
"executePersistentSchedules" : "true",
"instanceTimeout" : "60000",
"instanceRecoveryTimeout" : "60000",
"instanceCheckInInterval" : "10000",
"instanceCheckInOffset" : "0"
},
"advancedProperties" : {
"org.quartz.scheduler.instanceName" : "OpenIDMScheduler"
}
}
Some of the optional properties are not in the default configuration file and are used specifically in the context of clustered OpenIDM instances.
The properties in the scheduler.json file relate
to the configuration of the Quartz Scheduler.
-
threadCountspecifies the maximum number of threads that are available for the concurrent execution of scheduled tasks. -
instanceIDcan be any string, but must be unique for all schedulers working as if they are the same 'logical' Scheduler within a cluster. -
instanceTimeoutspecifies the number of milliseconds that must elapse with no check-ins from a scheduler instance before it is considered to have timed out or failed. Default: 60000 (60 seconds). When this timeout is reached, the instance is considered to be in a "recovery" state. -
instanceRecoveryTimeoutspecifies the number of milliseconds that must elapse while an instance is in the "recovery" state (meaning that it has failed and another instance is now attempting to recover its acquired triggers) before the scheduler instance recovery is considered to have failed. Default: 60000 (60 seconds). -
instanceCheckInIntervalSpecifies the period (in milliseconds) after which an instance checks in to indicate that it has not timed out or failed. Default: 10000 (10 seconds). -
instanceCheckInOffsetAn offset (in milliseconds) that can be used to shift the checkin events of instances to prevent all instances from accessing the repository simultaneously (if the instances are started simultaneously and have the same check-in intervals). This offset can help to minimize MVCC warnings from multiple instances simultaneously trying to recover the same failed instance. Default: 0. -
executePersistentSchedulesallows you to disable persistent schedule execution for a specific node. If this parameter is set tofalse, the Scheduler Service will support the management of persistent schedules (CRUD operations) but it will not execute any persistent schedules. The value of this property can be a string or boolean and istrueby default. -
advancedProperties(optional) enables you to configure additional properties for the Quartz Scheduler.
For details of all the configurable properties for the Quartz Scheduler, see the Quartz Scheduler Configuration Reference.
Each schedule configuration file, openidm/conf/schedule-
has the following
format:
schedule-name.json
{
"enabled" : true,
"persisted" : false,
"concurrentExecution" : false,
"type" : "cron",
"startTime" : "(optional) time",
"endTime" : "(optional) time",
"schedule" : "cron expression",
"misfirePolicy" : "optional, string",
"timeZone" : "(optional) time zone",
"invokeService" : "service identifier",
"invokeContext" : "service specific context info",
"invokeLogLevel" : "(optional) debug"
}The schedule configuration properties are defined as follows:
- enabled
-
Set to
trueto enable the schedule. When this property is set tofalse, OpenIDM considers the schedule configuration dormant, and does not allow it to be triggered or executed.If you want to retain a schedule configuration, but do not want it used, set
enabledtofalsefor task and event schedulers, instead of changing the configuration or cron expressions. - persisted (optional)
-
Specifies whether the schedule state should be persisted or stored in RAM. Boolean (
trueorfalse),falseby default. For more information, see Section 11.2, “Configuring Persistent Schedules”. - concurrentExecution
-
Specifies whether multiple instances of the same schedule can run concurrently. Boolean (
trueorfalse),falseby default. Multiple instances of the same schedule cannot run concurrently by default. This setting prevents a new scheduled task from being launched before the same previously launched task has completed. For example, under normal circumstances you would want a liveSync operation to complete its execution before the same operation was launched again. To enable concurrent execution of multiple schedules, set this parameter totrue. The behavior of "missed" scheduled tasks is governed by the misfirePolicy. - type
-
Currently OpenIDM supports only
cron. - startTime (optional)
-
Used to start the schedule at some time in the future. If this parameter is omitted, empty, or set to a time in the past, the task or event is scheduled to start immediately.
Use ISO 8601 format to specify times and dates (
).YYYY-MM-DDThh:mm:ss - endTime (optional)
-
Used to plan the end of scheduling.
- schedule
-
Takes cron expression syntax. For more information, see the CronTrigger Tutorial and Lesson 6: CronTrigger.
- misfirePolicy
-
For persistent schedules, this optional parameter specifies the behavior if the scheduled task is missed, for some reason. Possible values are as follows:
-
fireAndProceed. The first execution of a missed schedule is immediately executed when the server is back online. Subsequent executions are discarded. After this, the normal schedule is resumed. -
doNothing, all missed schedules are discarded and the normal schedule is resumed when the server is back online.
-
- timeZone (optional)
-
If not set, OpenIDM uses the system time zone.
- invokeService
-
Defines the type of scheduled event or action. The value of this parameter can be one of the following:
-
"sync"for reconciliation -
"provisioner"for LiveSync -
"script"to call some other scheduled operation defined in a script
-
- invokeContext
-
Specifies contextual information, depending on the type of scheduled event (the value of the
invokeServiceparameter).The following example invokes reconciliation.
{ "invokeService": "sync", "invokeContext": { "action": "reconcile", "mapping": "systemLdapAccount_managedUser" } }For a scheduled reconciliation task, you can define the mapping in one of two ways:
-
Reference a mapping by its name in
sync.json, as shown in the previous example. The mapping must exist in theopenidm/conf/sync.jsonfile. -
Add the mapping definition inline by using the
"mapping"property, as shown in the example in Alternative Mappings.
The following example invokes a LiveSync action.
{ "invokeService": "provisioner", "invokeContext": { "action": "liveSync", "source": "system/OpenDJ/__ACCOUNT__" } }For scheduled LiveSync tasks, the
"source"property follows OpenIDM's convention for a pointer to an external resource object and takes the formsystem/.resource-name/object-typeThe following example invokes a script, which prints the string
Hello Worldto the OpenIDM log (/openidm/logs/openidm0.log.X) each minute.{ "invokeService": "script", "invokeContext": { "script": { "type": "text/javascript", "source": "java.lang.System.out.println('Hello World’);" } } }Note that these are sample configurations only. Your own schedule configuration will differ according to your specific requirements.
-
- invokelogLevel (optional)
-
Specifies the level at which the invocation will be logged. Particularly for schedules that run very frequently, such as LiveSync, the scheduled task can generate significant output to the log file, and the log level should be adjusted accordingly. The default schedule log level is
info. The value can be set to any one of the SLF4J log levels:-
"trace" -
"debug" -
"info" -
"warn" -
"error" -
"fatal"
-

