0
votes

OK, forgive me if my understanding / terminology are a little odd - I'm still getting to grips with the interaction between NSB and MSMQ.

Earlier today, I accidentally fired up our subscriber web application on my workstation using a production config file. This means my workstation registered itself with our production publisher app. I now can't work out how to get the publisher to stop publishing messages to my workstation, short of restarting the publisher service - which would be bad since it's a production system.

Looking in the queue manager on the publisher host system, I can see the private queue under Computer Management -> Services and Applications -> Message Queueing -> Outgoing Queues:

DIRECT=OS:DYLAN_PC\private$\DylanApplicationInputQueue

but I can't see any mechanism for removing the queue or deleting the subscription. Even having replaced the config for my local subscriber app, when I start my local subscriber now, messages from our production environment are appearing on the queue. Which makes doing any useful work a bit tricky. Any pointers to relevant bits of documentation would be most appreciated...

1
What kind of subscription storage did your configure in you publisher? Is it using MSMQ subscription storage? you should be able to see in the publishers endpoint config. It would be useful if you could edit the question with itAlmond

1 Answers

1
votes

Haven't dealt with NServiceBus myself before, but some digging through the documentation indicates that the reason that removing your subscription from your client config is irrelevant, is that you're already subscribed, and so the publisher is just sending stuff the moment you turn up again!

Two options appear to maybe work, depending on your setup:

  1. Go back to the publisher config, add a call to Bus.Unsubscribe early on. Then run your client once, let it unsubscribe, and then you can go back to using your proper local config.
  2. Delete the queue subscription from wherever that's actually stored, which I think is separate from the queue itself. If you're using SQL server 2008, nservicebus deleting subscription record after inserting it? may help as a guide (well, do the thing they didn't want to happen i.e. unsubscribe). This may be potentially a bit hairy depending on what dependant stuff NServiceBus has in the db, and how often it re-reads v.s. assuming it's cache is good however.