Trigger Module

Available:

Confluence 2.2 to Confluence 5.9

Changed:

In Confluence 3.5 and later, the trigger element accepts an optional child element (managed), which defines the scheduled job's availability in Confluence's administration console.

Status: Deprecated in Confluence 5.10 - use Job Config instead

Trigger plugin modules enable you to schedule when your Job Module are scheduled to run Confluence.

Trigger Plugin Module

The Trigger plugin module schedules Jobs within a plugin. Triggers are one of two types:

  • cron - jobs are scheduled using cron syntax
  • simple - jobs are scheduled to repeat every X seconds

Here is an example atlassian-plugin.xml fragment containing a Job with it's corresponding Trigger module using a cron-style expression (for reference, this expression will execute the job with key 'myJob' every minute):

<atlassian-plugin name="Sample Component" key="confluence.extra.component">
    ...
    <job key="myJob"
          name="My Job"
          class="com.example.myplugin.jobs.MyJob" />
    <trigger key="myTrigger" name="My Trigger">       
        <job key="myJob" />       
        <schedule cron-expression="0 * * * * ?" />     
        <managed editable="true" keepingHistory="true" canRunAdhoc="true" canDisable="true" />
    </trigger>
    ...
</atlassian-plugin>

The trigger element accepts the following attributes:

  • name — represents how this component will be referred to in the Confluence interface.
  • key — represents the internal, system name for your Trigger.

The trigger element also accepts the following elements:

  • schedule — defines a cron expression in its cron-expression attribute. For more information on cron expressions can be found on the Scheduled Jobs page (or the Cron Trigger tutorial on the Quartz website).
  • managed (Available in Confluence 3.5 and later only) — an optional element that defines the configuration of the job on the Scheduled Jobs administration page. If the managed element is omitted, then the job will not appear in the Scheduled Jobs administration page. This element takes the following attributes each of which take the values of either true or false:
    (tick) If any of these attributes are omitted, their values are assumed to be false.
    • editable — If true, the job's schedule can be edited.
    • keepingHistory — If true, the job's history persists and survives server restarts. If false, the job's history is only stored in memory and will be lost upon the next server restart.
    • canRunAdhoc — If true, the job can be executed manually on the Scheduled Jobs administration screen.
    • canDisable — If true, the job can be enabled/disabled on the Scheduled Jobs administration screen.

Here is another example, this time using a simple trigger that repeats every 3600000 milliseconds (1 hour) and will only repeat 5 times:

...
    <trigger key="myTrigger" name="My Trigger">
        <job key="myJob" />
        <schedule repeat-interval="3600000" repeat-count="5" />
     </trigger>    
...
Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport