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.
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 }
job-config
name
represents how this job config will be referred to in the Confluence interface.key
represents the internal system name for the job.job
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.perClusterJob
is true
, this job will run only once in a cluster rather than on every node.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-interval
allows 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
managed
is optional. If this is omitted the job won't appear in the Scheduled Jobs administration page in Confluence.false
:
true
, editable
allows the job schedule to be edited. This is forced to false
if schedule type is interval.true
, keepingHistory
means the job's history persists and survives server restarts. If set to false
, the job history is only stored in memory and will be lost on the next server restart.true
, canRunAdhoc
allows the job to be executed manually on the Scheduled Jobs administration screen.true
, canDisable
allows the job to be enabled or disabled on the Scheduled Jobs administration screen.<job>
module. Use <job-config>
module with Atlassian Spring Scanner as described previously.<job-config>
is similar to <trigger>
.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: