Azure WebJobs - No functions found - How do I make a trigger-less job?

前端 未结 2 848
既然无缘
既然无缘 2021-02-19 01:23

I\'m new to Azure WebJobs, I\'ve run a sample where a user uploads an image to blob storage and inserts a record into the Queue, then the job retrieves that from the queue as a

2条回答
  •  时光说笑
    2021-02-19 01:55

    You could use the latest WebJobs SDK, which supports triggering job functions on schedule, based on the same CRON expression format. You can use it to schedule your job every hour:

    [Disable("DisableMyTimerJob")]
    public static void TimerJob([TimerTrigger("00:01:00")] TimerInfo timerInfo, TextWriter log)
    {
        log.WriteLine("Scheduled job fired!");
    }
    

    Moreover, the WebJobs SDK also has a DisableAttribute that can be applied to functions, that allows you to enable/disable functions based on application settings. If you change the app setting in the Azure Management Portal, the job will be restarted (https://azure.microsoft.com/en-us/blog/extensible-triggers-and-binders-with-azure-webjobs-sdk-1-1-0-alpha1/).

提交回复
热议问题