简体   繁体   English

锁定时间到期后,我不能续订吗? 使用Azure Service Bus主题

[英]Can't i renew the lock after the lock duration has expired ? Using Azure Service Bus Topic

Using Azure Service Bus Topic 使用Azure Service Bus主题

For exammple After 5 minutes if a try to renew a lock, it says Lock has expired message!! 例如5分钟后,如果尝试更新锁,则显示锁已过期消息!

What are the other options to come over it.. 还有其他解决方案吗?

I have transactions that take more than 5 minutes, and after that i want to set the brokered message status to completed. 我有超过5分钟的交易,之后我想将代理消息状态设置为已完成。

Any options? 有什么选择吗?

To add to Sam's answer, if the lock duration has passed you can't renew the lock on that message. 要补充Sam的答案,如果锁定时间已过,则无法更新该消息的锁定。 Once a lock expires the message is available to be handed out to another consumer. 一旦锁过期,便可以将该消息分发给其他使用者。 This means that if you were allowed to call renew lock after the lock has expired someone else may be processing that message and as far as the service bus is concerned it is already locked by that other consumer. 这意味着,如果允许您在锁到期后调用更新锁,则其他人可能正在处理该消息,并且就服务总线而言,该消息已被其他使用者锁定。 It could be argued that it would be a "nice to have" that RenewLock would check to see if the message was already handed out again and renew if not, but it doesn't do that. 可以说,RenewLock将检查消息是否已经再次分发并更新(如果不是)则是“很高兴”,但是这样做不会。 If you have enough consumers and given the messages are roughly handled in order it is more likely that the message would already be off somewhere else anyway. 如果您有足够的使用者,并且给定消息是按顺序粗略处理的,那么该消息很可能已经在其他任何地方出现了。

If you have the scenario of a unit of work taking longer than 5 minutes you'll need to manage the renewal either during your processing or on a separate thread. 如果您的工作单元耗时超过5分钟,则需要在处理期间或在单独的线程上管理续订。 For example, if your processing is something where you do some work and have control flow return to your code quite often the processing thread can keep an eye on the amount of time and renew as necessary; 例如,如果您的处理工作需要您做一些工作,并且控制流经常返回到您的代码,则处理线程可以关注时间量并根据需要进行更新; however, it is more likely that your processing thread will be busy, in which case you'd want to have a separate thread that handles the renewal. 但是,您的处理线程很可能会很忙,在这种情况下,您希望有一个单独的线程来处理续订。

You might look at what your system is doing for processing and see if this could be broken up into smaller work chunks and spread across a series of queues. 您可能会查看系统正在处理的内容,并查看是否可以将其分解为较小的工作块并散布在一系列队列中。

You can use the RenewLock() Method that is documented here: http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.brokeredmessage.renewlock.aspx 您可以使用此处记录的RenewLock()方法: http : //msdn.microsoft.com/zh-cn/library/microsoft.servicebus.messaging.brokeredmessage.renewlock.aspx

QueueClient queueClient = QueueClient.CreateFromConnectionString(serviceBusConnectionString, queueName);
BrokeredMessage receivedMessage = await queueClient.ReceiveAsync();
await receivedMessage.RenewLockAsync();

You can also have a look at this article on how to implement reliable messaging loops with Service Bus: http://msdn.microsoft.com/en-us/library/hh851750.aspx 您还可以查看有关如何使用Service Bus实现可靠的消息传递循环的本文: http : //msdn.microsoft.com/zh-cn/library/hh851750.aspx

暂无
暂无

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

相关问题 Azure Service Bus Topic订阅服务器锁定已过期异常 - Azure Service Bus Topic Subscriber lock expired exception 锁定持续时间对天蓝色服务总线主题订阅的重要性 - Lock duration significance on azure service bus topic subscriptions 当锁定持续时间未过去时,Azure 服务总线为非分区队列抛出 MessageLockLostException - Azure Service Bus throwing MessageLockLostException for non-partitioned queue when lock duration has not passed 如何使用REST Client在Azure Service Bus主题上窥视锁定消息而不接收和删除 - How to Peek-Lock Message and not Receive and Delete on Azure Service Bus Topic using REST Client Azure 服务总线 - MaxConcurrentCalls=1 - 提供的锁无效。 要么锁过期 - Azure Service Bus - MaxConcurrentCalls=1 - The lock supplied is invalid. Either the lock expired 我无法重试 Azure 服务总线主题中的失败项目 - I can't retry failed item in Azure Service Bus topic Azure服务总线消息锁是否未续订? - Azure Service Bus message lock not being renewed? 无法添加Azure Service Bus主题订阅筛选规则 - Can't add Azure Service Bus Topic Subscription filter rule Azure Function App Service Bus Topic 在设置一些 PrefetchCount 限制和锁定错误时触发随机错误 - Azure Function App Service Bus Topic trigger random error while settings some PrefetchCount limit and lock error as well 消息工作成功完成后,Azure Service Bus“提供的锁无效” - Azure Service Bus “The lock supplied is invalid” after message work successfully completed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM