nservicebus subscriber unable to unsbuscriber
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 v开发者_开发知识库ar 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.
nRkYou 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.
精彩评论