I have some microservices which post message in queue and then one my listen function listen it and do a further process.
I set Lock time for 120 sec but what is best way to determine and set lock time for queue listener. cos I have 10 replica of same function running at same time and I want to make sure if any function pick that message it must be lock until it complete process.
I put random number now as 120 lock time but what is way to calculate it if we are calling some other api from that listener function cos we are not sure how other api are going to behave.
In
Peek Lockmode, lock duration time usually depends on the longest execution possible, which could be up to 5 minutes today with Azure Service Bus. If the operation completes faster than that, the message will be completed, and the next one will be retrieved. The way Azure Functions are implemented, a processor is used that can automatically extend the lock time if processing takes longer. This is achieved by specifyingmaxAutoRenewDurationin thehost.jsonfile. By default, the value is set to 5 minutes. Note thatmaxAutoRenewDurationshould be larger thanmaxLockDuration.Regarding Functions App, if it's running in the consumption plan, the maximum execution time will be 10 minutes.