QuartzJobBean not executing spring boot

Viewed 627

I have a spring boot project which uses spring-boot-starter-quartz, version '2.2.2.RELEASE' and springBootVersion '1.5.10.RELEASE' to schedule jobs.

I am facing an issue randomly where the some of the triggers aren't executed.

The following is the quartz.properties file in my project

org.quartz.threadPool.threadCount=10
org.quartz.jobStore.class =org.quartz.impl.jdbcjobstore.JobStoreCMT
org.quartz.job-store-type =jdbc
org.quartz.jobStore.useProperties=false

org.quartz.jobStore.driverDelegateClass =org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.tablePrefix =QRTZ_
org.quartz.dataSource.fieldstar.driver=com.mysql.jdbc.Driver
org.quartz.dataSource.fieldstar.maxConnections = 15
org.quartz.scheduler.jobFactory.class = org.quartz.simpl.SimpleJobFactory

When I trigger a job, I can see the rows of my triggers in the database table QRTZ_TRIGGERS. When the START_TIME reaches, the triggers are deleted from this table and the implementation provided for this job using QuartzJobBean is executed for some triggers but not for the rest.

The following is the code to schedule a job.

JobBuilder.newJob(CommonReminderListener.class)
                .withIdentity("jobKey")
                .withDescription("Test" + jobKey.getGroup())
                .usingJobData(jobDataMap)
                .storeDurably()
                .build();

The following is my implementation for the QuartzJobBean

@Component
public class CommonReminderListener extends QuartzJobBean {

    @Override
    public void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("Executing Job with key", jobExecutionContext.getJobDetail().getKey());
    }


}

I am not sure what seems to be the problem. Any help is appreciated.

0 Answers
Related