Hi there,
I wish to use Quartz.net to send out an x amount of emails every hour. Basically a job must get triggered and then the job can take anything from a minute to lets say an hour and a half to complete. I then want the next job to only trigger an hour after the last one has completed.
I thought I can do this by pausing the pausing the trigger and then resuming when it's done but then everything fires at once.
So I thought I can do something like this:
(The minute timer is just for testing. The scheduler is set to fire every 5 seconds)
public class EmailJob : IJob
{
public void Execute(IJobExecutionContext context)
{
Debug.WriteLine(DateTime.Now.ToShortTimeString());
context.Scheduler.PauseAll();
System.Threading.Thread.Sleep(60000);
context.Scheduler.ResumeAll();
}
}
After that minute of sleeping, this job will execute a lot of times, all at the same time.
I hope all of that made sense. Is there a way to do what I want to do with Quartz.net? Wait for the current job to finish and then schedule the next run x amount of time after that.
Thanks for your time.