We have a number of topics in the Azure SB and constantly update our environments through a VIP swap from staging to production.

When an instance is running in staging we don't want the subscribers to read and delete messages intended to send events to our instances running in the production slot.

The Solution I have come up with is to create subscriptions that include the RoleEnvironment.SubscriptionId in the name. These are then deleted during RoleEntryPoint.OnStop() to avoid unused subscriptions.

Is there a more elegant solution to this and am I missing something obvious?

1

There are 1 best solutions below

2
On

One approach is to have a configuration setting that your application understands. It can then be changed between staging/production environments and the same config value can be used to enable/disable things you do not want in production. For Service Bus you can create a Staging and a Production namespace and then put the url in config.