My app has two components. One is a notifier process (Notifier) that runs on a media server and publishes a message using NServiceBus when a file is modified. The other is a MVC web application (PhotoWeb) that subscribes to these messages to perform cache invalidation, etc.
I’m setting up a staging environment for QA, and the problem is that the PhotoWeb app that’s running in the staging environment is receiving notifications from both the staging media server AND the live media server – which is unexpected, and a little odd…
The PhotoWeb instance that’s deployed to production has this configuration:
<MsmqTransportConfig InputQueue="PhotoWebInputQueue" ErrorQueue="PhotoWebErrorQueue" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<clear/>
<!-- Where do we subscribe to messages about filesystem changes? -->
<add Messages="MyProject.Messages" Endpoint="NotifierInputQueue@webmedia"/>
</MessageEndpointMappings>
</UnicastBusConfig>
and the configuration that’s in the staging environment is:
<MsmqTransportConfig InputQueue="PhotoWebInputQueue" ErrorQueue="PhotoWebErrorQueue" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<clear/>
<!-- Where do we subscribe to messages about filesystem changes? -->
<add Messages="MyProject.Messages" Endpoint="NotifierInputQueue@staging_media"/>
</MessageEndpointMappings>
</UnicastBusConfig>
A couple of theories spring to mind:
- I’ve misunderstood what a queue actually is – and the
PhotoWebInputQueueis actually a shared network resource instead of a queue that’s local to a specific server - A previous deployment has caused NServiceBus to subscribe to the live webmedia queue on the staging web server, and this subscription is persisting across restarts, etc.
However, my NServiceBus-fu isn’t strong enough to know how to test either of those theories. Anything obviously wrong with this configuration or architecture that you can see?
Thanks,
Dylan
The only way your notifier can be sending messages to both subscribers is if there is a subscription for both subscribers in the notifier’s subscription store. The subscription consists of:
When the publisher receives a message it evaluates the message against each subscription in turn, and sends the message on to each matching subscriber.
If you clear down the live notifier’s subscription store and then restart the live subscriber this should resolve the issue.