I am trying to understand job durability in Quartz. According to the docs if you specify .StoreDurably() when creating a job, the job will persist (note I am using a database-backed store) even when there are no current triggers. Does this then imply that if I am not specifying durability that I cannot report on jobs that have already completed? Meaning, that once the job finishes and I am out of my trigger's (if I have one) JobHasExecuted() method that there is no longer any record of the job having run?
Asked
Active
Viewed 762 times
1 Answers
3
In general, there is no record of any jobs having run in the scheduler. Quartz.Net doesn't keep track of job history, other than just a count.
If you do not set a job to be durable and all triggers are removed or finished, the scheduler will remove the job from the store. If it's durable and you query the store, the scheduler will return the job, but it won't have any associated triggers.

jvilalta
- 6,679
- 1
- 28
- 36
-
When you say the scheduler will return the job but it won't have any associated triggers, will it tell me if an individual instance of the job execution was successful (completed) or not? Also related, what is a scenario/use-case for durable jobs? There seems to be little "overhead" (for lack of a better term) associated with recreating the job definition, so I want to make sure I understand what types of jobs might be candidates for being durable vs. not. – Howiecamp Jul 06 '15 at 16:05
-
2Once the scheduler finishes running a job, your best bet to get any information about whether it finished successfully is using a job listener. Once the scheduler has notified any listeners, it cleans up and there is no information kept on previous executions. I can't think of a proper scenario for durable jobs. I've never used them and actually find they get in the way if you're adding jobs programmatically. I suppose you could use them as some sort of history if you always give them a unique name, like adding a datetime to the name. – jvilalta Jul 06 '15 at 16:53
-
Thanks for your input here. I am indeed using listeners to determine success or failure (from Quartz's perspective) by simply checking if the jobException parameter is null. – Howiecamp Jul 06 '15 at 17:49