锁定持续时间对Azure Service Bus主题订阅的重要性 [英] Lock duration significance on azure service bus topic subscriptions

查看:92
本文介绍了锁定持续时间对Azure Service Bus主题订阅的重要性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究服务总线队列和主题的锁定持续时间和renewlock机制.但是,对于主题订阅,锁定持续时间到底意味着什么还不清楚.

I have been looking at lockdurations and renewlock mechanisms for service bus queue and topics. However it is not clear about what exactly does lock duration mean for topic subscriptions.

例如:

如果我有一个主题GameScoreUpdate,并且有多个订阅者.

If i have a topic GameScoreUpdate and it has multiple subscribers.

因此,有关此主题的任何消息都将传递给所有订户.

So any message to this topic will be delivered to all the subscribers.

现在,如果在一个订阅"Subscription1"上,我的锁定持续时间为30秒.但是邮件处理未完成.那么锁会过期吗?

now if On one subscription "Subscription1", i have a lock duration of 30 seconds. but message processing is not complete.then the lock expires?

此后会发生什么?其他订阅者已经收到此消息.当前的订户正在处理该消息.

What happens after this? the other subscribers have already been delivered this message. current subscriber is processing the message.

在这种情况下,锁定持续时间有何意义?

Whats the significance of lockduration in this case?

推荐答案

将每个订阅视为收件箱".每个订户得到一个.一条消息已发送给所有订阅者,但实际上,它是该消息的副本,并假设其具有匹配的条件,该消息被放置在每个收件箱"中.

Think of each subscription as an "inbox". Each subscriber gets one. A message is sent to all subscribers, but realistically, it's a clone of the message that is placed into every "inbox", assuming it has a matching criteria.

当给定的订户尝试使用 PeekLock 模式处理收件箱"中的消息时,该消息将标记为不可见.如果在 LockDuration 时间内无法处理该消息,则该消息将重新出现在收件箱"中,并尝试再次进行处理.直到用完 MaxDeliveryCount 次尝试为止.在这种情况下,邮件将变成死信.

When a given subscriber tries to process a message from an "inbox" using PeekLock mode, the message is marked as invisible. If there's a failure to process the message in LockDuration time, the message will re-appear in the "inbox" and will be attempted for processing again. Until MaxDeliveryCount attempts are exhausted. In that case, message will be dead-lettered.

这是竞争消费者真正需要的.IE.当您的订户(查看给定订阅/收件箱"的过程)被扩展以处理大量消息时.

This is really needed for competing consumers. I.e. when your subscriber (a process looking at a given subscription/"inbox") is scaled out for processing larger number of messages.

在这种情况下,锁定持续时间有何意义?

Whats the significance of lockduration in this case?

LockDuration 指示一个队列(毕竟订阅是一个队列),以使竞争消费者看不到消息,以确保当前处理节点可以在 LockDuration 定义的时间范围内处理该消息..续订锁定机制可确保对当前正在处理的邮件的锁定被扩展,以允许在需要的情况下比 LockDuration 更长的处理时间.请记住,重要的是锁更新不能成功.

LockDuration instructs a queue (subscription is a queue after all) to keep message invisible from competing consumers to ensure current processing node can handle it withing time frame defined by LockDuration. Renew lock mechanism ensures that the lock on the currently being processed message is extended to allow longer than LockDuration processing time if needed so. Important thing to remember, lock renewal is not guaranteed to be successful.

这篇关于锁定持续时间对Azure Service Bus主题订阅的重要性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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