Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling Quartz job exception so that it runs its next normal turn without it being refired immediately or dropped

How can I handle the "exceptions" caused by a job run by Quartz scheduler so that it is run on the following scheduled time. I don't want it to refireImmediately or I don't want it to drop this job. Just keep it in the jobstore until its next turn.

like image 485
Sam Avatar asked Mar 28 '12 09:03

Sam


1 Answers

If you throw an exception from a Job and it is not JobExecutionException with refireImmediately set, this execution will be discarded and proceed with normal schedule. E.g. when a job is suppose to run every 10 seconds and a single execution threw an exception, Quartz will simply discard this exceution and run next one after 10 seconds.

Unfortunately the only way of refiring with some delay is a custom code (maybe a JobListener implementation?), refireImmediately does what it says. It is a pity Quartz does not support it out-of-the-box.

See a proposed solution here (but not the accepted answer): Quartz retry when failure.

like image 111
Tomasz Nurkiewicz Avatar answered Oct 23 '22 04:10

Tomasz Nurkiewicz