0

I am using quartz.net with CRON scheduling. I set misfire instruction to : fire and proceed:

 trigger = Quartz.TriggerBuilder.Create()
                       .WithIdentity(jobData.JobId, jobData.ClientApplicationId.ToString())//.WithCronSchedule(scheduleInfo.CronExpression, WithMisfireHandlingInstructionDoNothing())
                        .WithSchedule(Quartz.CronScheduleBuilder.CronSchedule(new Quartz.CronExpression(scheduleInfo.CronExpression)).WithMisfireHandlingInstructionFireAndProceed())//.WithMisfireHandlingInstructionDoNothing())  ///.WithMisfireHandlingInstructionFireAndProceed()
                       .StartAt(DateTime.Now).ForJob(iJobDetail)
                       .Build();

From what I read, if a trigger was missed , it should fire as soon as the scheduler is up (one time maximum, even if the job was suppose to run many times).

For some reason when I test it, the job is never triggered. Say I have a job that should run every hour starting from 4:00. I turn on the scheduler at 7:30 , I don't get any trigger fires - until 8:00. misfireThreshold is set to (60000) - one minute.

The job is statefuul and does not allow concurrent runs. I am using a persistent store (AdoJobStore) -saving the schedules to the MSSQL DB.

Any idea why the trigger isn't firing on schedule activation?

omer schleifer
  • 3,897
  • 5
  • 31
  • 42
  • 1
    Are you using a persistent job store? Next fire time is calculated when job is added and scheduler started, with RAMJobstore this information is lost on shutdown. – Marko Lahma Jan 09 '14 at 04:57
  • Yes, that's a very important thing - I'm using A Dateabase and not RAM store, I will add it to my question. thanks – omer schleifer Jan 09 '14 at 07:55
  • 1
    And also which version? Make sure you are running the latest version. – Marko Lahma Jan 10 '14 at 05:45
  • Version is 2.1.2 , I will try to update. In the documentation I couldn't find a relevant bug fix, but I hope the upgrade will help. Thanks – omer schleifer Jan 12 '14 at 14:15
  • I've updated to version 2.2.1 but still get the same problem. Any idea how to fix it or at least analyze it? Thanks – omer schleifer Jan 14 '14 at 05:41

2 Answers2

0

Try the code below instead. Make sure to replace {YourCronExpressionString} with your own cron expression.

trigger = Quartz.TriggerBuilder.Create()
                   .WithIdentity(jobData.JobId, jobData.ClientApplicationId.ToString())
                   .WithCronSchedule("{YourCronExpressionString}", x => x.WithMisfireHandlingInstructionFireAndProceed())
                   .StartAt(DateTime.Now).ForJob(iJobDetail)
                   .Build();

Source: Quartz.NET setting MisfireInstruction

Community
  • 1
  • 1
d.i.joe
  • 606
  • 9
  • 22
-2

try to use PauseJob(jobKey) method to missfire

use ResumeJob(jobKey) method to trigger it again

for example:

set cronexpression:every 4 hours

at 7:30 , call pauseJob method

and at 8:01,call resumeJob method

the job at 8:00 will be refire

  • Is this for testing purpose? I test by closing the sceduler , changing the time of my computer and than open the scheduler again – omer schleifer Jan 15 '14 at 08:38