I am using latest version of .net sdk (Azure.Messaging.ServiceBus).
I want to renew the lock duration of the message since processing of messages takes more than 5 min so that other listeners/consumers to the client cant receive while one of the listner/consumer processing message. I have tried by setting MaxAutoLockRenewalDuration property , but it didnt work, after 5 min other consumer is consuming the message before compelting the current consumer.
Sample code which i have used
var client = CreateQueueClient("managedQueue");
var proc = client.CreateProcessor("managedQueue", options: new ServiceBusProcessorOptions
{
MaxConcurrentCalls = 2,
AutoCompleteMessages = false,
ReceiveMode = ServiceBusReceiveMode.PeekLock,
MaxAutoLockRenewalDuration = new TimeSpan(0,20,0),
}) ;
proc.ProcessMessageAsync += MessageHandler;
proc.ProcessErrorAsync += ErrorHandler;
Sample Callback Code
async Task MessageHandler(ProcessMessageEventArgs args)
{
try
{
string body = args.Message.Body.ToString();
Console.WriteLine($"Received: {body}");
await Task.Delay(480000);//8 min
// complete the message. messages is deleted from the queue.
await args.CompleteMessageAsync(args.Message);
}
catch(Exception ex)
{
Console.WriteLine("Exception In Handler:"+ex);
}
}
Can you please any one help me regarding this auto renew the lock duration of the message.
Thanks