指导OnMessageOptions.AutoRenewTimeout [英] Guidance OnMessageOptions.AutoRenewTimeout

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

问题描述

有人可以提供对使用Azure的服务总线OnMessageOptions.AutoRenewTimeout的一些指导
<一href=\"http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.onmessageoptions.autorenewtimeout.aspx\" rel=\"nofollow\">http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.onmessageoptions.autorenewtimeout.aspx

Can someone offer some more guidance on the use of the Azure Service Bus OnMessageOptions.AutoRenewTimeout http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.onmessageoptions.autorenewtimeout.aspx

因为我还没有发现这个选项多文档,并想知道这是否是续订消息锁的正确方法

as I haven't found much documentation on this option, and would like to know if this is the correct way to renew a message lock

我的用例:

1)消息处理队列中有5分钟的时间锁定(允许的最大)

1) Message Processing Queue has a Lock Duration of 5 minutes (The maximum allowed)

2)使用OnMessageAsync消息泵从队列中读取(有ReceiveMode.PeekLock)的长时间运行的处理可能需要长达10分钟之前处理消息手动调用msg.CompleteAsync信息处理器

2) Message Processor using the OnMessageAsync message pump to read from the queue (with a ReceiveMode.PeekLock) The long running processing may take up to 10 minutes to process the message before manually calling msg.CompleteAsync

3)我要留言处理器自动更新它锁起来,直到它的预计完成处理的时间(〜10分钟)。如果在这段期间后它尚未完成时,锁定应自动释放。

3) I want the message processor to automatically renew it's lock up until the time it's expected to Complete processing (~10minutes). If after that period it hasn't been completed, the lock should be automatically released.

感谢

- 更新

我从来没有最终得到的AutoRenewTimeout任何更多的指导。我结束了使用自定义MessageLock类,自动更新基于定时器消息锁定。

I never did end up getting any more guidance on AutoRenewTimeout. I ended up using a custom MessageLock class that auto renews the Message Lock based on a timer.

请参阅要点 -
https://gist.github.com/Soopster/dd0fbd754a65fc5edfa9

推荐答案

要处理长消息处理,你应该设置 AutoRenewTimeout == 10分钟(你的情况)。这意味着,锁将在这10分钟之内时 LockDuration 已过期更新。

To handle long message processing you should set AutoRenewTimeout == 10 min (in your case). That means that lock will be renewed during these 10 minutes each time when LockDuration is expired.

因此​​,例如,如果你的 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.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆