简体   繁体   English

Azure Service Bus主题多个订阅者

[英]Azure Service Bus Topics Multiple subscribers

I am new to Azure Service Bus and would like to know if I can multiple subscribers to a queue or topic? 我是Azure Service Bus的新手,想知道我是否可以将多个订阅者添加到队列或主题中? In rabbit MQ I can have multiple subscribers to 1 publisher. 在Rabbit MQ中,我可以拥有1个发布者的多个订阅者。

What I am trying to do is, I am using CQRS and when certain commands come into the system when the event is handled I want to push them into a message queue. 我要做的是,我正在使用CQRS,当处理事件时某些命令进入系统我想将它们推入消息队列。

I want 2 subscribers to be able to get the messages from that queue, one for me to process internally. 我希望2个订阅者能够从该队列中获取消息,其中一个用于我内部处理。 another one for process and send externally. 另一个用于处理并向外发送。

I am new to Azure Service Bus and would like to know if I can multiple subscribers to a queue or topic? 我是Azure Service Bus的新手,想知道我是否可以将多个订阅者添加到队列或主题中?

Yes. 是。 This is possible with Azure Service Bus Topics. Azure Service Bus主题可以实现这一点。 There can be multiple subscribers to a message sent to a topic. 发送给主题的消息可以有多个订阅者。 From this link : 从这个link

In contrast to queues, in which each message is processed by a single consumer, topics and subscriptions provide a one-to-many form of communication, in a publish/subscribe pattern. 与队列相反,其中每个消息由单个消费者处理,主题和订阅以发布/订阅模式提供一对多形式的通信。 Useful for scaling to very large numbers of recipients, each published message is made available to each subscription registered with the topic. 对于扩展到非常大量的收件人很有用,每个已发布的邮件都可用于向该主题注册的每个订阅。 Messages are sent to a topic and delivered to one or more associated subscriptions, depending on filter rules that can be set on a per-subscription basis. 消息被发送到主题并传递给一个或多个关联的订阅,具体取决于可以基于每个订阅设置的过滤规则。

The way it works is that you create a topic and then create multiple subscriptions in that topic. 它的工作方式是您创建一个主题,然后在该主题中创建多个订阅。 In each subscription, you can define message filtering rules. 在每个订阅中,您可以定义邮件过滤规则。 When a message is sent to a topic, Azure Service Bus matches that message against the filtering rules in each subscription and if a matching rule is found, then the message is sent to that subscription. 将消息发送到主题时,Azure Service Bus会根据每个订阅中的过滤规则匹配该消息,如果找到匹配规则,则会将消息发送到该订阅。

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

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