I'm using Azure Service Bus Topics, and I'm running into a strange issue.
In the following code, I am trying to delete a subscription if it exists, and then create it again. However, the call to SubsciptionExists
returns false, yet the subsequent call to CreateSubscription
fails with a 409 conflict saying that the subscription already exists.
What am I doing wrong?
// check to see if we need to delete the subscription first
if (_namespaceManager.SubscriptionExists(TopicName, subscriptionId))
{
_namespaceManager.DeleteSubscription(TopicName, subscriptionId);
}
// error here on create...
_namespaceManager.CreateSubscription(TopicName, subscriptionId);
Also, if I look at the subscription list in the management portal, I do not see the subscription that I am trying to delete and re-create.
I am guessing it might be a timing issue. Can you try to wait for a bit before attempting to recreate the subscription? And btw why delete and create again? Are you trying to purge the topic this way?