Azure Function V2 Service Bus Message Deferral

前端 未结 1 1197
野趣味
野趣味 2021-01-19 05:25

I am attempting to convert my v1 function to a v2 function, but I cannot find a replacement for deferring a message.

In V1 of Azure Functions it was a method on the

1条回答
  •  佛祖请我去吃肉
    2021-01-19 06:04

    As you mention, the new message receiver offers an async defer method and you can add this to your function by using the following code:

    [FunctionName("MyFunction")]
    public static async Task Run([ServiceBusTrigger("topic", "subscription", Connection = "AzureServiceBusPrimary")]Message message, string lockToken, MessageReceiver messageReceiver, ILogger log)
    {
        //Your function logic
        await messageReceiver.DeferAsync(lockToken);
    }
    

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