本文介绍了Azure ServiceBus AutoRenewTimeout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过.net SDK使用Azure ServiceBus队列. OnMessageHandler/OnMessageOptions上有一个名为"AutoRenewTimeout"的标志,但是对于此值的实际含义似乎有些困惑.

I am using Azure ServiceBus Queues through the .net SDK. There is a flag on the OnMessageHandler/OnMessageOptions called "AutoRenewTimeout", but there seems to be confusion on what this value actually means.

在此处的官方文档中 https://msdn .microsoft.com/en-us/library/microsoft.servicebus.messaging.onmessageoptions.aspx ,它建议AutoRenewTimeout应该大于队列锁定持续时间.

On the official documentation here https://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.onmessageoptions.aspx it suggests that the AutoRenewTimeout should be greater than the queue lockduration.

这似乎表明AutoRenewTimeout或多或少是处理消息应花费的最长时间.例如如果锁定时间为1分钟,而autorenewtimeout为5分钟,则该消息将总共更新5次,然后放弃并再次显示在队列中.还有其他StackOverflow答案可以确认是这种情况,例如 https://stackoverflow.com/a/36051408

This seems to suggest that the AutoRenewTimeout is more or less the maximum time that it should take to process a message. e.g. If you have a lock duration of 1 minute, and an autorenewtimeout of 5 minutes, the message will be renewed a total of 5 times before giving up and making it visible on the queue again. There is also other StackOverflow answers confirming this to be the case e.g. https://stackoverflow.com/a/36051408

因此,例如,如果您的LockDuration为3分钟,而AutoRenewTimeout为10分钟,则每3分钟将自动更新一次锁定(分别在3分钟,6分钟和9分钟之后),并且自从消息被消耗起,锁定将在12分钟后自动释放

So if for example your LockDuration is 3 minutes and AutoRenewTimeout is 10 minutes then every 3 minute lock will be automatically renewed (after 3 min, 6 min and 9 min) and lock will be automatically released after 12 minutes since message was consumed.

但是,在进行更多研究时,我偶然发现了一条旧推文( https://twitter.com/clemensv/status/649940087267041284 ),看起来是Microsoft消息传递的首席架构师.在此推文中,似乎暗示了AutoRenewTimeout是它将调用"RenewLock"方法的时间间隔.

However on more research, I stumbled upon an old tweet (https://twitter.com/clemensv/status/649940087267041284) by what looks to be the Lead Architect for Messaging at Microsoft. In this tweet it seems to suggest that AutoRenewTimeout is instead the interval in which it will call the "RenewLock" method.

因此,例如,如果您的锁定时间为1分钟,则AutoRenewTimeout应该为30秒左右,以确保在释放消息锁之前将其更新.

So for example if your lockduration is 1 minute, the AutoRenewTimeout should be something like 30 seconds to ensure that the message lock is renewed before it gets released.

在我自己的测试中,我倾向于前者是正确的,但该推文使我感到怀疑,因为我可能不知道是否充分利用了AutoRenewTimeout

In my own tests, I'm leaning towards the former being correct, but the tweet is making me suspicious on the fact maybe I don't know the full use of AutoRenewTimeout

推荐答案

您的测试是正确的.

AutoRenewTimeout将允许将处理时间延长到LockDuration以上,而不会增加DeliveryCount.应该将其设置为最大处理时间回调.将其作为时间范围读取,以等待处理回调完成.在此之后,OnMessage API将不会发出续订.

AutoRenewTimeout will allow to extend processing time beyond LockDuration w/o increasing the DeliveryCount. It should be set to the maximum processing time callback. Read it as a time range to wait for processing callback to complete. After that time OnMessage API will not issue a renewal.

这篇关于Azure ServiceBus AutoRenewTimeout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 06:25