-
Notifications
You must be signed in to change notification settings - Fork 157
Open
Description
I propose implementing the TriggerListener for the QuartzAdaptor. In the methods we can log info like when the trigger will fire again on trigger fire
e.g.
@Override
public void triggerFired(Trigger trigger, JobExecutionContext context) {
LogEvent evt = getLog().createInfo();
evt.addMessage(getName() + " Trigger Fired and it will fire again at " + trigger.getNextFireTime() + " "
+ context.getJobDetail());
Logger.log(evt);
}
@Override
public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context) {
return false;
}
@Override
public void triggerMisfired(Trigger trigger) {
LogEvent evt = getLog().createInfo();
evt.addMessage(getName() + " Trigger MIS-Fired and will fire again at " + trigger.getNextFireTime());
Logger.log(evt);
}
I also propose adding a a misfire instruction when the trigger is created. At times the trigger does not fire and we have no clue what happened. The above trigger listener will help with logging the misfire.
Based on the default config of "org.quartz.jobStore.misfireThreshold", "60000", if the trigger is not fired in one minutes time it will be treated as a misfire and the instruction withMisfireHandlingInstructionFireAndProceed it will fire the trigger.
This may not suit everyone but can be made configurable to select what to do on a misfire.
e.g.
trigger = TriggerBuilder.newTrigger()
.withIdentity(e.getAttributeValue("id"), getName())
.withSchedule(CronScheduleBuilder.cronSchedule(e.getAttributeValue("when"))
.withMisfireHandlingInstructionFireAndProceed())
.build();
Metadata
Metadata
Assignees
Labels
No labels