chap-scheduler-conf.xml revision a34a8ffed8c62150fb188e30d4294b42ce381431
<?xml version="1.0" encoding="UTF-8"?>
<!--
! CCPL HEADER START
!
! This work is licensed under the Creative Commons
! Attribution-NonCommercial-NoDerivs 3.0 Unported License.
! To view a copy of this license, visit
! http://creativecommons.org/licenses/by-nc-nd/3.0/
! or send a letter to Creative Commons, 444 Castro Street,
! Suite 900, Mountain View, California, 94041, USA.
!
! You can also obtain a copy of the license at
! legal/CC-BY-NC-ND.txt.
! See the License for the specific language governing permissions
! and limitations under the License.
!
! If applicable, add the following below this CCPL HEADER, with the fields
! enclosed by brackets "[]" replaced with your own identifying information:
! Portions Copyright [yyyy] [name of copyright owner]
!
! CCPL HEADER END
!
! Copyright 2011-2012 ForgeRock AS
!
-->
<chapter xml:id='chap-scheduler-conf'
xmlns='http://docbook.org/ns/docbook'
version='5.0' xml:lang='en'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd'
xmlns:xlink='http://www.w3.org/1999/xlink'
xmlns:xinclude='http://www.w3.org/2001/XInclude'>
<title>Scheduling Synchronization</title>
<para>OpenIDM provides scheduling for synchronization operations such as
LiveSync and reconciliation. You schedule the operations using
<command>cron</command>-like syntax.</para>
<para>This chapter describes scheduling for reconciliation and LiveSync.
Yet, you can use OpenIDM's scheduler service to schedule other events, too.
See the <link xlink:href="integrators-guide#appendix-scheduling"
xlink:role="http://docbook.org/xlink/role/olink"><citetitle>Scheduler
Reference</citetitle></link> appendix for details.</para>
<para>You configure the scheduler through JSON objects. The corresponding
configuration file names take the form
<filename>openidm/conf/[org.forgerock.openidm.]scheduler-<replaceable
>schedule-name</replaceable>.json</filename>, where
<literal>[org.forgerock.openidm.]</literal> is optional and added
automatically when OpenIDM reads the configuration, and
<replaceable>schedule-name</replaceable> is the logical name for the
scheduled operation, such as
<literal>reconcile_systemXmlAccounts_managedUser</literal>.</para>
<section xml:id="scheduler-configuration-file">
<title>Scheduler Configuration</title>
<para>The scheduler configuration file,
<filename>openidm/conf/[org.forgerock.openidm.]scheduler-<replaceable
>schedule-name</replaceable>.json</filename> has the following format.</para>
<programlisting language="javascript">{
"enabled" : true,
"type" : "<replaceable>cron</replaceable>",
"startTime" : "<replaceable>(optional) time</replaceable>",
"endTime" : "<replaceable>(optional) time</replaceable>",
"schedule" : "<replaceable>cron expression</replaceable>",
"timeZone" : "<replaceable>(optional) time zone</replaceable>",
"invokeService" : "<replaceable>service identifier</replaceable>",
"invokeContext" : "<replaceable>service specific context info</replaceable>"
}</programlisting>
<itemizedlist>
<listitem>
<para>The optional properties <literal>"startTime"</literal>,
<literal>"endTime"</literal>, and <literal>"timeZone"</literal> properties
can be absent, or empty.</para>
<para>When specifying times and dates, use ISO 8601 format,
<literal><replaceable>YYYY</replaceable>-<replaceable>MM</replaceable
>-<replaceable>DD</replaceable>T<replaceable>hh</replaceable>:<replaceable
>mm</replaceable>:<replaceable>ss</replaceable></literal>.</para>
</listitem>
<listitem>
<para>OpenIDM relies on the Quartz Scheduler. The <replaceable>cron
expression</replaceable> to use is described in the <link xlink:show="new"
xlink:href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html"
><citetitle>CronTrigger Tutorial</citetitle></link> and in <link
xlink:href="http://www.quartz-scheduler.org/docs/tutorial/TutorialLesson06.html"
xlink:show="new"><citetitle>Lesson 6: CronTrigger</citetitle></link>.</para>
</listitem>
<listitem>
<para>The <literal>"invokeService"</literal> property takes either
<literal>"sync"</literal> for reconciliation or
<literal>"provisioner"</literal> for LiveSync.</para>
<para>You can also specify the service identifier by its full name as in
<literal>"invokeService" : "org.forgerock.openidm.sync"</literal>.</para>
</listitem>
<listitem>
<para>The <literal>"invokeContext"</literal> property depends on the
setting for <literal>"invokeService"</literal>.</para>
<para>For LiveSync, <literal>"source"</literal> takes an external resource
name and object type.</para>
<programlisting language="javascript">
{
"invokeService": "provisioner",
"invokeContext": {
"action": "activeSync",
"source": "system/ldap/account"
}
}</programlisting>
<para>For reconciliation, <literal>"mapping"</literal> takes the name of
the mapping configured in
<filename>openidm/conf/sync.json</filename>.</para>
<programlisting language="javascript">
{
"invokeService": "sync",
"invokeContext": {
"action": "reconcile",
"mapping": "systemLdapAccounts_managedUser"
}
}</programlisting>
</listitem>
</itemizedlist>
</section>
<section xml:id="scheduler-examples">
<title>Scheduler Examples</title>
<para>The following example shows a schedule for reconciliation that
is not enabled. When enabled (<literal>"enabled" : true,</literal>),
reconciliation runs every 30 minutes, starting on the hour.</para>
<programlisting language="javascript">
{
"enabled": false,
"type": "cron",
"schedule": "0 0/30 * * * ?",
"invokeService": "sync",
"invokeContext": {
"action": "reconcile",
"mapping": "systemLdapAccounts_managedUser"
}
}</programlisting>
<para>The following example shows a schedule for LiveSync enabled
to run every 15 seconds, starting at the beginning of the minute.</para>
<programlisting language="javascript">
{
"enabled": false,
"type": "cron",
"schedule": "0/15 * * * * ?",
"invokeService": "provisioner",
"invokeContext": {
"action": "activeSync",
"source": "system/ldap/account"
}
}</programlisting>
</section>
</chapter>