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
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.