Event Listener module
Job module
Language module
Macro Module
Servlet Filter module
Servlet module
Theme module
Web UI modules
Workflow module

Job Config module

Available:

Confluence 5.10 and later

Job Config module (JobConfigModuleDescriptor) defines an atlassian-scheduler JobConfig within a plugin. Atlassian Scheduler is used to create scheduled tasks in Atlassian applications.

JobConfig module

This module defines an atlassian-scheduler JobConfig within a plugin. Here's an example:

1
2
<job-config name="My job" key="myJobId">
    <job key="myJobRunner" perClusterJob="true" clusteredOnly="true"/>
    <schedule cron-expression="0 * * * * ?" jitterSecs="10"/>
    <managed editable="true" keepingHistory="true" canRunAdhoc="true" canDisable="true"/>
</job-config>

If you are using Atlassian Spring Scanner, ensure your job runner is defined as a Spring bean with a @org.springframework.stereotype.Component or @javax.inject.Named annotation and implements JobRunner interface:

1
2
@Named
public class MyJobRunner implements JobRunner {
    // Your code here
}

Configuration

job-config

  • The name represents how this job config will be referred to in the Confluence interface.
  • The key represents the internal system name for the job.

job

  • The key points to your JobRunner, make sure that it has the same value as your class name, except the first letter should be lowercase. Another option is to have key value match with value of @Named annotation.
  • When perClusterJob is true, this job will run only once in a cluster rather than on every node.
  • When clusteredOnly is true, this job won't be scheduled in non-clustered environment. This is optional.

schedule

  • Either a cron-expression or repeat-interval must be present.

  • repeat-intervalallows you to use an interval instead of a cron-expression.

    • This example repeats every hour (3600000 milliseconds) and only 5 times:

      1
      2
      <schedule repeat-interval="3600000" repeat-count="5"/>
      
    • repeat-count is optional when repeat-interval is used.

    • To repeat indefinitely, set repeat-count to -1 or omit it.

    • To run the job only once set repeat-count to 0.

  • jitterSecs is optional and introduces some random jitter.  This is only for Confluence Cloud. It prevents many thousands of servers from attempting to do similar things all at once. By providing a jitter value less than the size of the schedule frequency, we spread the load caused by a process over time.

managed

Migration from <job> and <trigger>

  • There is no direct replacement for <job> module. Use <job-config> module with Atlassian Spring Scanner as described previously.
  • To make the migration easier, the XML of <job-config> is similar to <trigger>.
  • For managed jobs, the key of <job-config> is used to look up the i18n job name (scheduledjob.desc.<key>), and display it in the Confluence admin UI. Previously, it was the key of <job>.

Rate this page: