Skip to main content
Skip table of contents

Job Expiry and Removal

You need to configure both job expiry and job removal.

Job Expiry

To set the job expiry:

  1. Go to the Tomcat instance that is running SuperWEB2 and open <tomcat_home>\webapps\webapi\WEB-INF\config\data-access-config-jqm.xml in a text editor.

    Make a backup copy of this file before making any changes.

  2. Locate the following line:

    XML
    <!-- <property name="globalJobExpiryPeriod" value="7 days" /> -->
  3. Remove the comments:

    XML
    <property name="globalJobExpiryPeriod" value="7 days" />
  4. Change the value to set the expiry time. The expiry time must be set in days and must include the word day or days. The following are some examples of valid expiry periods: 5 days, 1 day, 0.2 day7.3 days
  5. Save your changes to data-access-config-jqm.xml.
  6. Restart the instance of Tomcat where you have made changes.

Job Removal

Once you have configured an expiry period, you need to activate the scheduled task to automatically remove expired jobs from the database.

  1. Go to the Tomcat instance that is running Job Queue Manager and open <tomcat_home>\webapps\queuedjobservice\WEB-INF\config\common\service-config.xml in a text editor.

    Make a backup copy of this file before making any changes.

  2. Locate the following section:

    XML
    <!-- Un-comment the lines below to enable job expiry.
        <bean name="expiredJobRemover" class="org.springframework.scheduling.quartz.JobDetailBean">
            <property name="jobClass" value="au.com.str.jobqueue.server.scheduling.ExpiredJobRemoval" />
            <property name="jobDataAsMap">
                <map>
                    <entry key="entityManagerFactory" value-ref="entityManagerFactory" />
                </map>
            </property>
        </bean>
        <bean id="scheduleTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
            <property name="jobDetail" ref="expiredJobRemover"/>
            <!- run every minute: "0 0/1 * * * ?" ->
            <!- run every morning at 6 AM ->
            <property name="cronExpression" value="0 0 6 * * ?"/>
        </bean>
        <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
            <property name="triggers">
                <list>
                    <ref bean="scheduleTrigger" />
                </list>
            </property>
        </bean>
     -->
  3. Remove the comments from the start and end of this section:

    XML
        <bean name="expiredJobRemover" class="org.springframework.scheduling.quartz.JobDetailBean">
            <property name="jobClass" value="au.com.str.jobqueue.server.scheduling.ExpiredJobRemoval" />
            <property name="jobDataAsMap">
                <map>
                    <entry key="entityManagerFactory" value-ref="entityManagerFactory" />
                </map>
            </property>
        </bean>
        <bean id="scheduleTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
            <property name="jobDetail" ref="expiredJobRemover"/>
            <!- run every minute: "0 0/1 * * * ?" ->
            <!- run every morning at 6 AM ->
            <property name="cronExpression" value="0 0 6 * * ?"/>
        </bean>
        <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
            <property name="triggers">
                <list>
                    <ref bean="scheduleTrigger" />
                </list>
            </property>
        </bean>
    
  4. Edit the following line to specify when you want the scheduled task to run a cleanup of expired jobs.

    XML
            <property name="cronExpression" value="0 0 6 * * ?"/>

    You need to specify the scheduled time in the form of a cron expression. The values represent seconds, minutes, hours, day of month, month, day of week.

  5. Remove the following lines (these are just examples; they need to be removed because once you have removed the comments that enclose the whole section, these lines will not be properly commented out):

    XML
            <!- run every minute: "0 0/1 * * * ?" ->
            <!- run every morning at 6 AM ->

    As an alternative to deleting these lines, if you want to leave them as comments for future reference, you can do this by adding an additional - symbol at the start and end of each line, to make them into valid comments. For example:

    XML
            <!-- run every minute: "0 0/1 * * * ?" -->
            <!-- run every morning at 6 AM --> 
  6. Save your changes to service-config.xml.

  7. Restart the instance of Tomcat where you have made changes.

If you are running multiple instances of Job Queue Manager against a single Job Queue Manager database, make sure you do not run multiple instances of the job removal task at the same time. This will cause unnecessary concurrent database access and error messages in the log files.

Either:

  • Configure the expired job remover on only one of the Job Queue Manager instances; or
  • Make sure that each expired job remover has a sufficiently different scheduled trigger time so that they do not run concurrently.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.