You are looking at documentation for an older release. Not what you want? See the current release documentation.
eXo Platform provides a class that can be configured as a scheduled job. When it runs, it calls the syncAll
method
of the OrganizationIntegrationService
.
To configure the job, add the following configuration to your sync.xml
:
<external-component-plugins>
<target-component>org.exoplatform.services.scheduler.JobSchedulerService</target-component>
<component-plugin>
<name>OrgInitializerCronJob</name>
<set-method>addCronJob</set-method>
<type>org.exoplatform.services.scheduler.CronJob</type>
<description>Schedule the organization integration operation</description>
<init-params>
<properties-param>
<name>cronjob.info</name>
<description>Invoke initializer periodically</description>
<property name="jobName" value="OrgInitializerCronJob"/>
<property name="groupName" value="group"/>
<property name="job" value="org.exoplatform.platform.organization.integration.OrganizationIntegrationJob"/>
<property name="expression" value="0 45 23 * * ? *"/>
</properties-param>
</init-params>
</component-plugin>
</external-component-plugins>
The only parameter you need to re-configure is the expression that schedules when the job is fired.
Here provided just a short explanation and some examples of the expression so that you can pick up one quickly. To learn its syntax, read CRON Expression documentation.
Cron expression examples
An expression consists of seven sub-expressions separated by a white space. For being easily recognized, in the following tables, each sub-expression is written in a column (the seventh sub is optional):
Seconds | Minutes | Hours | Day-of-Month | Month | Day-of-Week | Year | Description |
---|---|---|---|---|---|---|---|
0 | 45 | 23 | ? | * | * | * | 23:45 every day |
0 | 45 | 23 | ? | * | SUN | 23:45 every Sunday | |
0 | 45 | 23 | ? | * | 2-7 | 23:45 every days of the week except Sunday | |
0 | 45 | 23 | ? | * | TUE,THU | 23:45 every Tuesday and Thursday | |
0 | 45 | 23 | ? | * | SUNL | 23:45 the last Sunday of every months | |
0 | 45 | 23 | 1 | * | ? | 23:45, the 1st day of every months | |
0 | 45 | 23 | L | * | ? | 23:45, the last day of every months | |
0 | 0/15 | * | ? | * | * | * | once per 15 minutes, starting from the minute 0 |
Testing
The job calls the SyncAll
method. When it runs, you will see the following logs:
Start all Organizational model synchronization. [o.e.p.o.i.OrganizationIntegrationJob<DefaultQuartzScheduler_Worker-4>] Organizational model synchronization finished successfully. [o.e.p.o.i.OrganizationIntegrationJob<DefaultQuartzScheduler_Worker-4>]
For testing, you can configure it to run every 1 minute by using the expression: 0 0/1 * * * ? *
.