简体   繁体   English

AZURE Service Bus如何对订阅消息进行规则处理?

[英]How AZURE Service Bus rules with messages on subscription?

I don't get it. 我不明白

Say I have one queve, one topic, one subscroption. 说我有一个问题,一个主题,一个订阅。 And three clients that subscribe on that. 以及三个订阅的客户。

I send a message. 我发送一条消息。

First client recieve a message and call complete() action. 第一个客户端收到一条消息,并调用complete()操作。

Will second client recieve a message? 第二个客户会收到消息吗?

What if there will forth client, who subscribe on it? 如果有第四位客户(谁订阅了)怎么办?

Question is - when will message completely remove from queve/topic/subscription?? 问题是-何时将邮件从queve / topic / subscription中完全删除?

PS Case when "one-to-one" - is clear. PS“一对一”时的情况-很明显。

I would recommend you check out the Competing Consumers pattern. 我建议您查看“竞争消费者”模式。 ( https://msdn.microsoft.com/en-us/library/dn568101.aspx?f=255&MSPPError=-2147217396 ). https://msdn.microsoft.com/zh-cn/library/dn568101.aspx?f=255&MSPPError=-2147217396 )。

You can have many roles (ie Azure Worker Role) checking for messages in a queue (competing consumers), locking them exclusively while processing. 您可以具有许多角色(即Azure工人角色)来检查队列中的消息(竞争使用者),并在处理时将其锁定。 Each role is fighting for a message, and the first guy who grabs it (by chance), has it "exclusive" for the moment. 每个角色都在争取一个信息,而第一个抓住它的人(偶然地)暂时拥有它。 If the consumer that gets and processes the message succeeds, run the Complete() method, otherwise the Abandon(message). 如果获取并处理该消息的使用者成功,请运行Complete()方法,否则运行Abandon(message)。 Complete() finishes it for good, and Abandon throws it back into the frenzy of competing consumers. Complete()永久完成了它,而Abandon则将其重新投入到竞争消费者的狂热中。 You can even grab it again if you're healthy! 如果您健康的话,甚至可以再抓一次!

You can set the dead message parameter in the Azure Management Portal which determines how many times it can be reintroduced for other consumers. 您可以在Azure管理门户中设置无效消息参数,该参数确定可以为其他使用者重新引入该无效消息的次数。 At some point, things just aren't working, so kill the message so other messages can resume unimpeded. 在某些时候,一切都无法正常进行,因此请杀死该消息,以便其他消息可以不受阻碍地恢复。

Let me know if you have more specific needs. 如果您有更具体的需求,请告诉我。 Would be happy to help. 乐意提供帮助。 This pattern works extremely well. 这种模式非常好用。

Kindest regards... 最亲切的问候...

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

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