简体   繁体   中英

Handle TimeOut Service Bus Processor

I am currently writing azure service bus processor to process message from queue. If my process takes a long time (more than lock duration of message) than shouln't it timeout before it is available for another processor.

eg I have below code while doing ProcessMessageAsync handler and I have lock duration of 30 seconds.

          Console.WriteLine($"Message Recevied {args.Message.SequenceNumber}");

           await Task.Delay(5 * 10000);

I have also method attached to ProcessErrorAsync which I would expect that will handle exceptions. I see when message is not finished it gets available to other processor which case same message is now executing by multiple process. Is there a way that this can be avoided. We basically want if a process timesout than put the message with a delay to Service Bus.

There is. You can extend the maximum default lock duration by specifying message processor setting MaxAutoLockRenewalDuration , defining the maximum possible processing time for a message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM