spring-bootquartz-schedulerquartz

Quartz missing Jobs executions


I am using Quartz with MongoDB. I know it has a lot of issues and using this dependency.

For example I have 100 jobs each with 1 Simple trigger. Note that all the jobs have same execution time. When the jobs started to execute, only few jobs are successful remaining does not execute at all. How can I disable this behavior?

return TriggerBuilder.newTrigger()
    .withIdentity(jobName)
    .withSchedule(SimpleScheduleBuilder.simpleSchedule()
            .withMisfireHandlingInstructionFireNow()
            )
    .startAt(new Date(fireTime.atZone(getZoneId(triggerDetails)).toEpochSecond() * 1000))
    .usingJobData(jobDataMap)
    .forJob(jobName)
    .build();

My properties are:

threadPool:
  threadCount: 5 # thread count setting is ignored by the MongoDB store but Quartz requries it
  threadNamePrefix: Q_POOL

scheduler:
  instanceId : AUTO
  instanceName: myinstace

The Exception is:

Failed to lock trigger eventKey_312_312.312, reason: WriteError{code=11000, message='E11000 duplicate key error collection: ems.scheduler_events_locks index: keyGroup_1_keyName_1_type_1 dup key: { : \"eventKey_312_312\", : \"312\", : \"t\" }

What I am missing?


Solution

  • After spending days to find the problem and fix, I found that there was some issue with the quartz tables in MongoDB. When I run the same code/scenario with new created tables (generated by quartz) it start working as expected. I am still not able to figure out the issues with existing quartz tables (same name and indexes) but anyhow now will use this new created quartz tables for future jobs.