Azure Service Bus主题多个侦听器接收相同的消息 [英] Azure Service Bus Topic multiple listeners receive same message
问题描述
Hi Team,
我有一种情况,我正在尝试实现发布/订阅模式。
I have a situation where i am trying to implement pub/sub pattern.
使用Azure我是如果两个客户订阅同一主题,则发布消息并进入客户端。订阅只有其中一个是收到其他客户端没有得到的消息。
Using Azure i am publishing message and coming to client if two clients are subscribed to same topic & subscription only one of it is getting message other client is not getting.
简单来说:
我正在广播消息并且订阅了两个人到我的主题。当我广播消息时,只有一个人正在收到其他人没有得到的消息。下面是示例代码。
I am broadcasting message and two persons are subscribed to my Topic. When i broadcast message only one person is getting that message other doesn't get. Below is sample code.
subscriptionClient = new SubscriptionClient(sbConnectionString, sbTopic, sbSubscription);
var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandler)
{
MaxConcurrentCalls = 100000,
AutoComplete = false,
};
subscriptionClient.RegisterMessageHandler(ReceiveMessagesAsync, messageHandlerOptions);
在这种情况下,如果我遗漏了任何内容或Azure服务主题是错误的选项,请告诉我。
Please let me know if i am missing anything or Azure Service topic is wrong option in this case.
我试过AMPS它像魅力广播一样对所有订阅者
I tried AMPS it works like charm broadcasting to all subscribers
推荐答案
嗨 skalvag
给定
本节文档,您的用例与服务公交车主题似乎是有效的&非常好。实际上,我只是能够测试和通过使用
Service Bus Explorer 确认它是这样工作的,其中我在所有订阅中收到消息的副本。话虽如此,我怀疑你可能只需要添加一个过滤器:
Given this section of the documentation, your use-case with Service Bus Topics seems valid & perfectly fine. Actually, I was just able to test & confirm that it works that way by using Service Bus Explorer where i was receiving copies of the message across all subscriptions. With that said, i'm suspecting that you might just need to add a filter:
subscriptionClient.AddRuleAsync("default", new SqlFilter("1=1"));
这篇关于Azure Service Bus主题多个侦听器接收相同的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!