locked
Azure WebJobs RRS feed

  • Question

  • User153569883 posted

    Hi,

    Can we have multiple Schedules in a Single web Job of Microsoft Azure. We have certain functionalities  to happen in a single job within particular time i.e multiple schedules so I

    have tried through the timer but i need to know is there any other option other than CRON Expression.Thank you

    Friday, June 9, 2017 11:59 AM

All replies

  • User-271186128 posted

    Hi InayatN,

    Can we have multiple Schedules in a Single web Job of Microsoft Azure. We have certain functionalities  to happen in a single job within particular time i.e multiple schedules so I

    have tried through the timer but i need to know is there any other option other than CRON Expression.Thank you

    You could try to use the TimerTriggerAttribute

    Please refer to the following code:

    public class Program
    {
        static void Main(string[] args)
        {
            JobHostConfiguration config = new JobHostConfiguration();
    
            // Add Triggers for Timer Trigger.
            config.UseFiles(filesConfig);
            config.UseTimers();
            JobHost host = new JobHost(config);
            host.RunAndBlock();
        }
    
        // Function triggered by a timespan schedule every 15 sec.
        public static void TimerJob([TimerTrigger("00:00:15")] TimerInfo timerInfo, 
                                    TextWriter log)
        {
            log.WriteLine("1st scheduled job fired!");
        }
    
        // Function triggered by a timespan schedule every minute.
        public static void TimerJob([TimerTrigger("00:01:00")] TimerInfo timerInfo, 
                                    TextWriter log)
        {
            log.WriteLine("2nd scheduled job fired!");
        }
    }

    More details, see:

    https://stackoverflow.com/questions/29376271/separate-schedules-for-azure-webjob-functions

    Best regards,
    Dillion

    Monday, June 12, 2017 9:40 AM
  • User-664094036 posted

    You can make use of Scheduler in Azure. (+New > Scheduler)

    Have multiple scheduler point and call the webhook to kickoff your job.

    Once you upload your job goto its Properties to get the WebHook.

    Friday, July 14, 2017 11:14 AM
  • User153569883 posted

    Thank you sir for your valuable reply.

    Monday, August 7, 2017 2:09 PM