Hi @Pavel Kusonski ,
The error happens because message locks expire before processing is finished, even with a 15-second runtime, due to high concurrency or prefetching.
- Increase maxAutoRenewDuration: Change this setting in
host.json
to extend the lock renewal time (up to 5 minutes):
"extensions": {
"serviceBus": {
"maxAutoRenewDuration": "00:05:00",
"maxConcurrentCalls": 100 // Lower this if necessary
}
}
- Set
prefetchCount
to 0 inhost.json
to prevent cached messages from losing their locks. - Use
RenewMessageLockAsync
for messages that take a long time to process and add retry logic.
For more details, please refer to these documents:
Azure Service Bus message lock troubleshooting and Troubleshoot Azure Service Bus.
If you find the answer helpful, kindly click "Accept Answer" and upvote it. If you have any further questions or concerns, please feel free to reach out to us. We are happy to assist you.