I have an Azure Function (Consumption Plan) triggered by a service bus queue.
I set maxAutoRenewDuration
in host.json
{
"version": "2.0",
"extensions": {
"serviceBus": {
"messageHandlerOptions": {
"maxAutoRenewDuration": "00:10:00"
}
}
},
"functionTimeout": "00:10:00"
}
The expectation is that message lock will be renewed up to 10 minutes. However, if I look at function execution logs, I see message lock expires every 5 minutes, effectively retriggering the function.
The execution logs:
As can be seen from the logs, function executes exactly after 5 minutes (when the lock expires). I'd expect to see function being re-triggered every 10 minutes (assuming ofc function execution is not done yet).
This is my function:
[FunctionName(nameof(MyFunc))]
public async Task MyFunc(
[ServiceBusTrigger(queueName: "myqueue", Connection = "ServiceBusConnectionString")]
Message message,
ILogger logger,
ExecutionContext executionContext)
{
var invocationId = executionContext.InvocationId;
// long running processing, that sometimes can stretch beyond 5 minutes
await Process(invocationId, message);
}
How can I set auto renew duration, so that message lock being renewed until configured time ?
Azure Function v3, running .net core 3.1. OS: Windows
maxAutoRenewDuration
is (quoting) "The maximum duration within which the message lock will be renewed automatically." Which is aligned with what you see. – Sean FeldmanYou should make sure that maxAutoRenewDuration is as long as (or longer) than function timeout.
. So for that reason I havefunctionTimeout
equal to 10 minutes to matchmaxAutoRenewDuration
. But as can be seen from the logs, message lock expires after 5 minutes, function doesn't time out which makes me thinkmaxAutoRenewDuration
setting is ignored. – Michael