How to use the Atlassian Scheduler

Is there any documentation or updated examples on how to use the Atlassian Scheduler system (Bitbucket && https://developer.atlassian.com/jiradev/jira-platform/jira-data-center/plugin-guide-to-jira-high-availability-and-clustering#PluginGuidetoJIRAHighAvailabilityandClustering-Scheduledtasksandbackgroundprocesses)?

I’ve looked at https://bitbucket.org/cfuller/atlassian-scheduler-jira-example but the example uses the old plugin version instead of the newer version 2, which makes it harder to figure out how to configure the scheduler in the atlassian-plugin.xml.

I’ve also looked at Atlassian scheduler in 7.4.2 jira version not showing up right time in Scheduler details but the person asking the question didn’t provide an atlassian-plugin.xml file and they’re also having problems.

Any additional information would be helpful. I’d like to avoid using the SAL scheduler since it’s deprecated.

Don’t have another documentation for you, but with regards to the atlassian-scheduler-jira-example and you mean Spring scanner version 2, then the atlassian-plugin.xml would just be without all the ‘components’ and ‘compont-import’ tags and these will be annotated instead. i.e.:

atlassian-plugin.xml

<?xml version="1.0" encoding="UTF-8"?>

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}"/>
    </plugin-info>

    <!-- Creates the webwork action for debugging atlassian-scheduler status -->
    <webwork1 key="scheduler-example.actions" name="Scheduler Example Actions">
        <description>Scheduler Example Actions</description>
        <actions>
            <action name="com.atlassian.jira.plugins.example.scheduler.action.ShowSchedulerInfo" alias="ShowSchedulerInfo" roles-required="admin">
                <view name="success">/templates/actions/showsched.vm</view>
            </action>
        </actions>
    </webwork1>

    <ao key="ao-module">
        <description>Awesome active objects entity</description>
        <entity>com.atlassian.jira.plugins.example.scheduler.AwesomeStuff</entity>
    </ao>

</atlassian-plugin>

AwesomePluginJobRunnerImpl

@Named
public class AwesomePluginJobRunnerImpl implements AwesomePluginJobRunner
{

Example

@Named
public class Example
{

AwesomePluginScheduleManagerImpl

public class AwesomePluginScheduleManagerImpl implements AwesomePluginScheduleManager
{
    public AwesomePluginScheduleManagerImpl(@ComponentImport final SchedulerService schedulerService)
    {

AwesomeStuffDaoImpl

@Named
public class AwesomeStuffDaoImpl implements AwesomeStuffDao
{
    public AwesomeStuffDaoImpl(@ComponentImport final ActiveObjects ao)
    {

AwesomeStuffSalJobsImpl

@Named
public class AwesomeStuffSalJobsImpl implements AwesomeStuffSalJobs
{
    public AwesomeStuffSalJobsImpl(@ComponentImport  PluginScheduler pluginScheduler, AwesomeStuffDao awesomeStuffDao)
    {
...
    public AwesomeStuffSalJobsImpl(@ComponentImport PluginScheduler pluginScheduler, AwesomeStuffDao awesomeStuffDao)
    {
        this.pluginScheduler = pluginScheduler;
        this.awesomeStuffDao = awesomeStuffDao;
    }


AwesomeLauncher

@ExportAsService
@Named
public class AwesomeLauncher implements LifecycleAware, InitializingBean, DisposableBean
{
    public AwesomeLauncher(final AwesomePluginJobRunner jobRunner, @ComponentImport final EventPublisher eventPublisher, @ComponentImport final SchedulerService schedulerService, @ComponentImport final ActiveObjects ao, final AwesomeStuffSalJobs awesomeStuffSalJobs, final Example example)
    {

ShowSchedulerInfo

    public ShowSchedulerInfo(@ComponentImport final SchedulerService schedulerService, @ComponentImport final SchedulerHistoryService schedulerHistoryService)
    {
        this.schedulerService = schedulerService;
        this.schedulerHistoryService = schedulerHistoryService;
    }
1 Like

I don’t remember the source of knowledge, but here is another example TimesheetJobScheduler.java.

1 Like

For what it’s worth, although I work on Jira Cloud these days and don’t have much time to maintain these old demos, if anyone feels charitable enough to update the code base for a modern version of Jira Server and submit a PR for it, I’m happy to review/merge it.

https://bitbucket.org/cfuller/atlassian-scheduler-jira-example is inaccessible for me. It’s so strange. Does anyone experience same thing ? I’m looking for an example for Scheduler service.

1 Like