I am using AutoLockRenew class register method after receiving message from azure service bus topic subscription using azure sdk for python.
Even if you use AutoLockRenew.register()
method in python which takes care of automatically renewing the lock for you - in case the renewable.renew_lock()
throws an exception if message lock expired, it fails silently!
The parent thread which is still executing business logic keeps on executing (until it calls message.complete()
when actually it would know about this) but the same time, the same message appears in the queue and second instance takes it up for processing! This mean the same message is now being processed simultaneously by 2 different receivers!
What is the recommended way of resolving this?
The code looks like below -
auto_renewer = AutoLockRenew()
with sub_client.get_receiver() as receiver:
for message in receiver:
auto_renewer.register(message)
....