nservicebus 订户无法取消订阅
您好
我在我的项目中使用 NServiceBus 1.9 RTM。
我正在使用发布者-分发者-订阅者模型。
我使用以下代码进行订阅,
var bus = NServiceBus.Configure.With()
.SpringBuilder()
.XmlSerializer()
.MsmqTransport()
.IsTransactional(false)
.PurgeOnStartup(false)
.UnicastBus()
.ImpersonateSender(false)
.DoNotAutoSubscribe()
.LoadMessageHandlers()
.CreateBus()
.Start();
bus.Subscribe<ITestMessage>();
_isSubscribed = true;
log.Info(" ITestMessage Subscribed successfully..");
_serviceBus = bus;
在订阅者中,当我想取消订阅时,
_serviceBus.Unsubscribe<ITestMessage>();
我正在这样做,但它不会取消订阅,也不会抛出任何错误。取消订阅后,EventHandler 仍然从分发器接收消息。
我有什么遗漏的吗...?任何人都可以帮助我。
nRk
Hi
I am using NServiceBus 1.9 RTM in my project.
I am using Publisher - Distributor - Subscriber model.
In subscriber I subscribed using the follwoing code
var bus = NServiceBus.Configure.With()
.SpringBuilder()
.XmlSerializer()
.MsmqTransport()
.IsTransactional(false)
.PurgeOnStartup(false)
.UnicastBus()
.ImpersonateSender(false)
.DoNotAutoSubscribe()
.LoadMessageHandlers()
.CreateBus()
.Start();
bus.Subscribe<ITestMessage>();
_isSubscribed = true;
log.Info(" ITestMessage Subscribed successfully..");
_serviceBus = bus;
when i want to unsbuscribe I am doing like
_serviceBus.Unsubscribe<ITestMessage>();
But it's not unsubscribing nor throwing any error. After unsbuscribing also EventHandler still receiving messages from the distributor.
Is there anything that I am missing...? Anyone can help me.
nRk
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要明白,取消订阅并不是针对分销商,而是针对发布商。现在,可能是您没有在 MessageEndpointMappings 中为 ITestMessage 的发布者配置正确的端点,这就是取消订阅不起作用的原因。订阅也可能无法正常工作,但事实是您已正确配置了分发器,并且其他人已告诉发布者订阅 ITestMessage 的分发器,这一事实隐藏了这一点。
希望有帮助。
You need to understand that unsubscribing is not something you do against the distributor but rather against the publisher. Now, it could be that you haven't configured the right endpoint for the publisher of your ITestMessage in your MessageEndpointMappings, and that's why the unsubscribe isn't working. It's likely that the subscribe isn't working either, but that's hidden by the fact that you have configured your distributor correctly, and someone else has told the publisher to subscribe the distributor for the ITestMessage.
Hope that helps.