Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Scheduled Task configured by job-config module not appearing and running in confluence

Sandro Hörler August 16, 2017

I've added a job-config module to my atlassian-plugin and added the necessary classes and registred the spring-bean. But the job does not appear in the confluence-recurring task console and the debugger never hits the execution of the scheduled-task.

I've added the following to the plugin-descriptor:

 <job-config name="Dashboard Aggregation" key="aggregator-job">
<job key="aggregationRunner" perClusterJob="true" clusteredOnly="true" />
<schedule repeat-interval="10000" />
<managed editable="true" keepingHistory="true" canRunAdhoc="true"
canDisable="true" />
</job-config>

i've also tried the schedule cron-expression

The implementing class is:



import java.sql.SQLException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.scheduler.JobRunner;
import com.atlassian.scheduler.JobRunnerRequest;
import com.atlassian.scheduler.JobRunnerResponse;



public class AggregationRunner implements JobRunner{
private static final Logger log = LoggerFactory.getLogger(MngtCountQueries.class);
private AggregateDashboardData aggregateDashboardData;

@Autowired
public AggregationRunner(@ComponentImport AggregateDashboardData aggregateDashboardData) {
this.aggregateDashboardData = aggregateDashboardData;
}

@Override
public JobRunnerResponse runJob(JobRunnerRequest request) {
try {
aggregateDashboardData.aggregateCounts();
} catch (SQLException e) {
log.error("Could not execute Scheduled Job named AggregateDashboardData cause of Database Error:" + e.getCause() + " " + e.getMessage());
return JobRunnerResponse.failed(e.getCause());
}
log.info("AggregateDashboardData successfully executed...");
return JobRunnerResponse.success("Successfully executed Job named AggregateDashboardData");
}

}

 and the plugin-context:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.atlassian.com/schema/atlassian-scanner
http://www.atlassian.com/schema/atlassian-scanner/atlassian-scanner.xsd">
<atlassian-scanner:scan-indexes/>

Confluence starts without any errors, but as written above, nothing happens.  I also tried to trigger a classNotFound exception by trying to change the job-config job-key to a other value, which is not a managed bean, but there is no such exception occuring... Is the <job key="..."> not referencing the Class implementing the JobRunner? Or how does confluence determine the class referenced by the job-config?

Thanks in advice

Sandro

1 answer

1 accepted

2 votes
Answer accepted
Sandro Hörler August 16, 2017

My fault:

If confluence is not clustered, you shuldn't set clusteredOnly="true"...

 <job-config name="Dashboard Aggregation" key="aggregator-job">
<job key="aggregationRunner" perClusterJob="true" clusteredOnly="false" />
<schedule cron-expression="0 0 10 * * ?" jitterSecs="10" />
<managed editable="true" keepingHistory="true" canRunAdhoc="true"
canDisable="true" />
</job-config>

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events