Azure Webjob 是否支持异步执行?

Azure Webjob supports Async execution if yes how?

我想执行我的 Azure Webjob 方法 async 但我想知道 Azure Webjob 是否支持 Async Execution or not

谁能帮我解决这个问题。异步执行 webjob 方法 ProcessSub1MessagesProcessSub2Messages

namespace WebJob1
{
public class Functions 
{
      public static void ProcessSub1Messages([ServiceBusTrigger("TestTopic", "Sub1")] BrokeredMessage message,
        TextWriter logger)
        {   
            Console.WriteLine("Webjob Start for Sub1 {0} {1}", message.MessageId, DateTime.Now);
            Thread.Sleep(100000);
            Console.WriteLine("Webjob End for Sub1 {0} {1}", message.MessageId, DateTime.Now);
        }

        public static void ProcessSub2Messages([ServiceBusTrigger("TestTopic", "Sub2")] BrokeredMessage message,
        TextWriter logger)
        {
            Console.WriteLine("Webjob Start for Sub2 {0} {1}", message.MessageId, DateTime.Now);
            Thread.Sleep(100000);
            Console.WriteLine("Webjob End for Sub2 {0} {1}", message.MessageId, DateTime.Now);
        }
}
} 

是的,WebJobs SDK 支持异步。只需将函数的 return 类型从 void 更改为 Task:

 public static async Task ProcessSub2Messages(
    [ServiceBusTrigge(("TestTopic", "Sub2")] BrokeredMessage message,
    TextWriter logger)
    {
        // async operations here
    }