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

前端 未结 2 839
既然无缘
既然无缘 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:45

    If you don't use any input/output attributes from the WebJobs SDK (QueueTrigger, Blob, Table, etc), you have to decorate the job with the NoAutomaticTrigger Attribute to be recognized by the SDK.

    0 讨论(0)
  • 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/).

    0 讨论(0)
提交回复
热议问题