简体   繁体   English

处理超时服务总线处理器

[英]Handle TimeOut Service Bus Processor

I am currently writing azure service bus processor to process message from queue.我目前正在编写 azure 服务总线处理器来处理来自队列的消息。 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.例如,我在执行 ProcessMessageAsync 处理程序时有以下代码,并且我的锁定持续时间为 30 秒。

          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.我还有附加到 ProcessErrorAsync 的方法,我希望它可以处理异常。 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.您可以通过指定消息处理器设置MaxAutoLockRenewalDuration来延长最大默认锁定持续时间,从而定义消息的最大可能处理时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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