Automation

Overview

Quartz is used to provide scheduled automation of tasks, similar to cron in Linux. This automation enables scheduled events such as data synchronization to proceed. It is configured in the following files:

  • web.xml - QuartzInitializer section initializes Quarts upon startup.
  • resources/quartz.properties
  • resources/quartz-jobs.xml
    • ExportSite - triggers org.rti.zcore.sync.job.ExportSite every x minutes, starting at top of each hour. There is a listener called ExportSiteJobListener that upon completion of the job executes UploadPendingFiles.class. The exportSite_to_uploadPendingFilesAutoJob job has a listener, UploadFilesJobListener. When this listener detects that the job has executed, it executes ImportFeed.class.
    • UploadPendingFiles - not scheduled - may be run manually.
    • ImportFeeds - not scheduled - may be run manually.
    • CreatePatientJob - used for testing. Not scheduled - may be run manually.
    • PingMasterServer - runs every 30 minutes.

Example Quartz job

    <job>
        <job-detail>
            <name>ExportSite</name>
            <group>DEFAULT</group>
            <description>A job that generates a zip of new and updated patient records</description>
            <job-class>
                org.rti.zcore.sync.job.ExportSite
            </job-class>
            <job-listener-ref>ExportSiteJobListener</job-listener-ref>
            <volatility>false</volatility>
            <durability>true</durability>
            <recover>false</recover>
        </job-detail>

        <trigger>
            <cron>
                <name>ExportSiteTrigger</name>
                <group>DEFAULT</group>
                <job-name>ExportSiteScheduler</job-name>
                <job-group>DEFAULT</job-group>
                <!--
                 Fire every 5 minutes at :05, :10, :15, :20...  - 0 0/6 * * * ?
                -->
                <cron-expression>0 0/5 * * * ?</cron-expression>
            </cron>
        </trigger>
    </job>

Job Listeners

    <job-listener class-name="org.rti.zcore.tims.utils.extensions.ExportSiteJobListener" name="ExportSiteJobListener"/>
    <job-listener class-name="org.rti.zcore.tims.utils.extensions.UploadFilesJobListener" name="UploadFilesJobListener"/>

Controlling Jobs

The Quartz scheduler may be stopped and started from the "Data Centre" section of the Administration section. Current scheduled actions may also be listed.