2

I have a big problem that is I have implemented a scheduler in my windows azure application that can execute a particular task in each day at 17.29. For the implementation I am using a third party tool that is Quartz. And I use following code to enable my scheduler

ISchedulerFactory schedFact = new StdSchedulerFactory();
IScheduler sched = schedFact.GetScheduler();
sched.Start();
JobDetail jobDetail = new JobDetail("mySendMailJob", typeof(SendMailJob));
Trigger trigger = TriggerUtils.MakeDailyTrigger(17, 29); 
trigger.Name = "mySendMailTrigger";
sched.ScheduleJob(jobDetail, trigger);

And I place this code in my application start.

My question is if I execute this code once then my scheduler start it working. Next time need not invoke. So how can I check if the scheduler is already invoked or not? If I place this code in application start each time execute the same code, that is totally useless. If there is any method. If anyone know please help me. I am using C#

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Isha John
  • 593
  • 2
  • 5
  • 16
  • If you are using AdoJobStore, then each time the trigger fired, this information will be stored on DB, you can access DB to detect. – Thinhbk Jun 26 '12 at 07:26

1 Answers1

1

This is a variation on the question "how to execute something only once". I recommend to most folks to use a self electing controller pattern. I explain that in this response.

Community
  • 1
  • 1
BrentDaCodeMonkey
  • 5,493
  • 20
  • 18