Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
How to check a scheduler is already executed or not in windows azure

Answered How to check a scheduler is already executed or not in windows azure

  • Tuesday, June 26, 2012 6:26 AM
     
      Has Code

    I have a big problem that is i am 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 quarts. 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(above given) once then my scheduler start it working. Next time need not invoke. So how can i check if the scheduler is already invoke or not. If i place this code in application start each time execute the same code, that is totally useless. If there is any methode. If anyone knw please help me. I am using c#.Net

All Replies

  • Tuesday, June 26, 2012 7:16 AM
     
     

    Hi,

    There are various ways you can implement the logic. Easiest way is to use remote desktop to view your role  

     Please look at the link to more about the Azure RDP

     http://msdn.microsoft.com/en-us/library/windowsazure/gg443832.aspx

    Also,

    You can also use windows diagnostics to log the events

    To know more: http://msdn.microsoft.com/en-us/magazine/ff714589.aspx

    Thanks,

    Vijay.

     

  • Tuesday, June 26, 2012 4:38 PM
     
     Proposed

    1. If you are concerned that the trigger wont fire next time - that should not happen unless you explicitly call sched.Stop somewhere.

    2. If you want to double check that the code that you want to execute, is indeed getting executed, like Vijay suggests, you could either RDP in or make use of Windows Diagnostics.

    Hope that helps.


    PS

  • Tuesday, June 26, 2012 8:29 PM
    Moderator
     
     Answered
    I replied to your thread over on Stackoverflow. The solution IMHO would be to use a "self electing controller" type of pattern to set up the job scheduler.
  • Wednesday, June 27, 2012 3:22 AM
    Moderator
     
     

    Hi,

    I think you write something in a table when this scheduler was finished, the next request will check the table's status to know if the scheduler has been executed.

    Hope this helps.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework