Skip to content

Commit

Permalink
Make the dynamic jobs "recoverable" so they are automatically restarted
Browse files Browse the repository at this point in the history
Currently none of the dynamic jobs are marked as “recoverable” hence in case of a Quartz scheduler failure/restart, they won’t be automatically retried.
In the case of a server crash or hard shutdown (some deployment) since the job are not restarted, the related PollableTaks will eventually be detected as a zombie when their TTL is reached and will then be marked as failed.

This PR is exploratory, it might be better to set it at the job level and let only well idem potent job use it.
  • Loading branch information
aurambaj committed Jul 20, 2023
1 parent d7db1a4 commit 63d798a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ public <I, O> PollableFuture<O> scheduleJob(QuartzJobInfo<I, O> quartzJobInfo) {
if (jobDetail == null) {
logger.debug("Job doesn't exist, create for key: {}", keyName);
jobDetail =
JobBuilder.newJob().ofType(quartzJobInfo.getClazz()).withIdentity(jobKey).build();
JobBuilder.newJob()
.ofType(quartzJobInfo.getClazz())
.withIdentity(jobKey)
.requestRecovery()
.build();
}

logger.debug("Schedule a job for key: {}", keyName);
Expand Down

0 comments on commit 63d798a

Please sign in to comment.