scheduling - Separate schedules for Azure webjob functions? -
is possible set separate schedules individual non-triggered functions in azure webjob? ask because have half dozen individual tasks i'd run @ different times of day , @ different intervals , don't want create separate project each.
yes can using timertriggerattribute
here sample code:
public class program { static void main(string[] args) { jobhostconfiguration config = new jobhostconfiguration(); // add triggers timer trigger. config.usefiles(filesconfig); config.usetimers(); jobhost host = new jobhost(config); host.runandblock(); } // function triggered 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 timespan schedule every minute. public static void timerjob([timertrigger("00:01:00")] timerinfo timerinfo, textwriter log) { log.writeline("2nd scheduled job fired!"); } } you can use cron expression specify when trigger function:
Comments
Post a Comment