Difference between revisions of "Configuring the Quartz Scheduler"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
m (Text replace - '{platform_installation}' to '{install_dir}')
Line 9: Line 9:
=====Enabling Quartz on a Platform Instance=====
=====Enabling Quartz on a Platform Instance=====


:1. Edit <tt>{platform_installation}/tomcat/webapps/networking/WEB-INF/web.xml</tt>
:1. Edit <tt>{install_dir}/tomcat/webapps/networking/WEB-INF/web.xml</tt>


:2. Modify the quartz servlet mapping so that:
:2. Modify the quartz servlet mapping so that:
::a. The <tt>config-file</tt> parameter points to the Quartz properties file:<br/> <tt>{platform_installation}/tomcat/conf/RN/quartz.properties</tt>
::a. The <tt>config-file</tt> parameter points to the Quartz properties file:<br/> <tt>{install_dir}/tomcat/conf/RN/quartz.properties</tt>


::b. The <tt>start-scheduler-on-load</tt> property is set to <tt>true</tt>, to make sure that quartz is started whenever the platform starts.
::b. The <tt>start-scheduler-on-load</tt> property is set to <tt>true</tt>, to make sure that quartz is started whenever the platform starts.
Line 56: Line 56:
|}
|}


:3. Edit <tt>{platform_installation}/tomcat/conf/RN/quartz.properties</tt>
:3. Edit <tt>{install_dir}/tomcat/conf/RN/quartz.properties</tt>


:4. Add the following information:
:4. Add the following information:
Line 78: Line 78:
Here is the procedure:
Here is the procedure:


:1. Open <tt>{platform_installation}/tomcat/webapps/networking/WEB-INF/web.xml</tt>  
:1. Open <tt>{install_dir}/tomcat/webapps/networking/WEB-INF/web.xml</tt>  


:2. Find the quartz servlet mapping for the first instance:
:2. Find the quartz servlet mapping for the first instance:
Line 107: Line 107:
To run a create a cluster of Quartz instances on different servers, each server must have the settings shown here. Otherwise, a Quartz instance will not know that the others exist, and will not lock job records that are in progress or completed.
To run a create a cluster of Quartz instances on different servers, each server must have the settings shown here. Otherwise, a Quartz instance will not know that the others exist, and will not lock job records that are in progress or completed.


:1. Edit <tt>{platform_installation}/tomcat/conf/RN/quartz.properties</tt>
:1. Edit <tt>{install_dir}/tomcat/conf/RN/quartz.properties</tt>


:2. Modify this line:
:2. Modify this line:

Revision as of 00:08, 23 June 2011

Configuring the Quartz Scheduler

Warn.png

Important:

  • Quartz must be enabled on at least one platform instance, or the platform won't run.
  • If you have multiple instances, Quartz should run on only one of them, unless you follow the Quartz clustering instructions below.
  • Changing the quartz configuration requires a restart of all Application Servers.
Enabling Quartz on a Platform Instance
1. Edit {install_dir}/tomcat/webapps/networking/WEB-INF/web.xml
2. Modify the quartz servlet mapping so that:
a. The config-file parameter points to the Quartz properties file:
{install_dir}/tomcat/conf/RN/quartz.properties
b. The start-scheduler-on-load property is set to true, to make sure that quartz is started whenever the platform starts.
Example:
<servlet>
    <servlet-name>
        QuartzInitializer
    </servlet-name>

    <display-name>
       Quartz Initializer Servlet
    </display-name>

    <servlet-class>
        org.quartz.ee.servlet.QuartzInitializerServlet
    </servlet-class>

    <init-param>
        <param-name>config-file</param-name>
        <param-value>C:/apache-tomcat-6.0.20/conf/RN/quartz.properties</param-value>
                         [ ^-- Path to the properties file ]
    </init-param>

    <init-param>
        <param-name>shutdown-on-unload</param-name>
        <param-value>true</param-value>
    </init-param>

    <init-param>
        <param-name>start-scheduler-on-load</param-name>
        <param-value>true</param-value>
                     [ ^--Enables Quartz ]
    </init-param>

    <load-on-startup>
         1
    </load-on-startup>
</servlet>
3. Edit {install_dir}/tomcat/conf/RN/quartz.properties
4. Add the following information:
a. Database user name (an admin user)
b. Password for that user
Example:
org.quartz.dataSource.myDS.URL = jdbc:mysql://...

org.quartz.dataSource.myDS.user = rootuser                 [database user]

org.quartz.dataSource.myDS.password = password        [database user password]
Moving Quartz to Another Platform Instance

Suppose you have one application server instance, and you have decided to add another to handle the traffic volume. And let's say you also decide to move quartz to the new instance, to further reduce the load on the original server. To that, you disable Quartz on the first instance, and start it on the second.

Here is the procedure:

1. Open {install_dir}/tomcat/webapps/networking/WEB-INF/web.xml
2. Find the quartz servlet mapping for the first instance:
<servlet>
     <servlet-name>
         QuartzInitializer
     </servlet-name>

      ...

     <init-param>
         <param-name>start-scheduler-on-load</param-name>
         <param-value>false</param-value>
                      [ ^-Disables Quartz ]
     </init-param>

      ...

</servlet>
3. For the second instance, follow the steps above, in Setting up Quartz on a Platform Instance
Setting up a Quartz Cluster

To run a create a cluster of Quartz instances on different servers, each server must have the settings shown here. Otherwise, a Quartz instance will not know that the others exist, and will not lock job records that are in progress or completed.

1. Edit {install_dir}/tomcat/conf/RN/quartz.properties
2. Modify this line:
org.quartz.scheduler.instanceId = AUTO                [EDIT THIS LINE]
3. Under # Configure JobStore, add these lines:
...
# Configure JobStore
org.quartz.jobStore.misfireThreshold = 60000          [ADD THESE LINES]
org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000