Running Azure WebJob without queue

2020-07-13 09:13发布

问题:

Is there a way to schedule a job without having listen to the queue? I mean I would like to run it every hour or so and do something, regardless of the queue. Does that even make sense? One solution I can think of is to queue a message to itself each time the job is done, but that doesn't look like a clean solution to me.

回答1:

Create a scheduled job with a 1 hour frequency and use Host.Call to invoke the function. See the ManualTrigger function in this code sample



回答2:

Of course, no need to listen to a queue. Check the WebJobs documentation on how to schedule a job: http://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/#CreateScheduled



回答3:

The easiest way to schedule a job is to use a TimerTrigger on the WebJob method you'd like to execute on a schedule.