I could implement something similar to the following in Azure Functions 1.0, but now it seems with 2.0 CompleteAsync()
and AbandonAsync()
are no longer available.
[FunctionName("Process")]
public static async System.Threading.Tasks.Task RunAsync(
[ServiceBusTrigger(
"%ServiceBus.Topic%", "%ServiceBus.Subscription%",
Connection = "AzureWebJobsServiceBus")]Message message, ILogger log) {
try {
MyMessageModel messageModel = message.GetBody<MyMessageModel>();
await DoAllTheThingsAsync().ConfigureAwait(false);
await message.CompleteAsync().ConfigureAwait(false);
} catch {
await message.AbandonAsync().ConfigureAwait(false);
throw;
}
}
Has control been relinquished to the Azure Function default for Peek Lock?