Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is native misfire handling in quartz.net, however it only goes as far as specifying whether the job should fire <a href="http://nurkiewicz.blogspot.co.uk/2012/04/quartz-scheduler-misfire-instructions.html" rel="nofollow">immediately again, or after a period of time or a number of times after misfiring.</a></p> <p>I think one option is to handle this internally from IncrementalImportJob. </p> <pre><code>try { //download data //import data } catch (Exception e) //something went wrong { //log the error UpdateFullImportJobTrigger(sched); } //Reschedule FullImportJob to run at a time of your choosing. public void UpdateFullImportJobTrigger(IScheduler sched) { Trigger oldTrigger = sched.getTrigger(triggerKey("oldTrigger", "group1"); TriggerBuilder tb = oldTrigger.getTriggerBuilder(); //if you want it to run based on a schedule use this: Trigger newTrigger = tb.withSchedule(simpleSchedule() .withIntervalInSeconds(10) .withRepeatCount(10) .build(); sched.rescheduleJob(oldTrigger.getKey(), newTrigger); //or use simple trigger if you want it to run immediately and only once so that //it runs again on schedule the next time. } </code></pre> <p>This is one way of doing it. Another would be abstracting this logic to a maintenance job that checks the logs every so often and if it finds a failure message from IncrementalImportJob, it fires FullImportJob. However, this depends to some extent on your logging system (most people use NLog or log4net).</p> <p>If on the other hand, your concern is that the job never ran in the first place because, for instance, the app/database/server was down, you could schedule FullImportJob to fire a few hours later and check if IncrementalImportJob has fired as follows:</p> <pre><code>//this is done from FullImportJob //how you retrieve triggerKey will depend on whether //you are using RAMJobStore or ADO.NET JobStore public void Execute(IJobExecutionContext context) { ITrigger incImportJobTrigger = context.Scheduler.GetTrigger(triggerKey); //if the job has been rescheduled with a new time quartz will set this to null if (!incImportJobTrigger.GetPreviousFireTimeUtc().HasValue) return; DateTimeOffset utcTime = incImportJobTrigger.GetPreviousFireTimeUtc().Value; DateTime previousTireTime = utcTime.LocalDateTime; if (previousTireTime.Day == DateTime.Now.Day) return; //IncrementalImportJob has not ran today, let's run FullImportJob } </code></pre> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload