Job Module


Confluence 2.2 to Confluence 5.9


Job modules are auto-wired in Confluence 4.0.1 and later.

Status: Deprecated in Confluence 5.10 - use Job Config instead

Job plugin modules enable you to add repeatable tasks to Confluence, which are in turn scheduled by Trigger Module.

Job Plugin Module

The Job plugin module adds a simple reusable component within a plugin. At a minimum, the module class must implement Quartz's Job interface, but for access to Confluence's objects and database you should extend Jobs are scheduled with Trigger Module


In Confluence 4.0.1 and later, Jobs are autowired by Spring (see: CONF-20162 for workarounds in earlier versions).

Here is an example atlassian-plugin.xml fragment containing a single Job module:

<atlassian-plugin name="Sample Component" key="confluence.extra.component">
    <job key="myJob"
          name="My Job"
          class="" perClusterJob="false" />
  • the name attribute represents how this component will be referred to in the Confluence interface.
  • the key attribute represents the internal, system name for your Job. This is what the Trigger will refer to.
  • the class attribute represents the class of the Job to be created. The class must have a no-argument constructor, or it will not be able to be instantiated by Confluence.
  • the perClusterJob attribute, if "true", indicates that this job will only run once when triggered in a cluster rather than once on every node.

For examples of how to schedule Jobs to be run, see Trigger Module.

Transaction Management

Please note that transaction management is not automatically applied when you extend The core Confluence services and managers are declaratively wrapped so individual calls to any of these services do not require you to perform explicit transaction management. However, you may need to manually wrap your job execution in a transaction if -

  1. You are making use of your own components which are not declaratively wrapped in a transaction via Spring configuration.
  2. You are sharing data between a number of different calls to one or more services

To programmatically wrap in a transaction in your plugin you should first import the SAL transaction template. So in your atlassian-plugin.xml include -

    <component-import name="SAL Transaction Template" key="transactionTemplate">

Import the following classes -

import com.atlassian.sal.api.transaction.TransactionCallback;
import com.atlassian.sal.api.transaction.TransactionTemplate;

Enable your job to be auto-wired via the constructor and wrap your execution in a transaction as shown -

public class MyJob
    private final TransactionTemplate transactionTemplate;

    public MyJob(final TransactionTemplate transactionTemplate)
        this.transactionTemplate = transactionTemplate;
    void performOperation()
        return transactionTemplate.execute(new TransactionCallback<T>()
            public T doInTransaction()
				// work goes here


Do not implement a single transaction which spans the work of a long lived job. This could impact the availability of the Confluence service.

(Discussion on automatic transaction management in jobs can be followed on CONF-35465).

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport