azure-service-bus-dotnet
azure-service-bus-dotnet copied to clipboard
Missing MessagingEntityAlreadyExistsException
In lue of this exception type, one has to handle the general ServiceBusException
and filter based on part of the exception message. Doing so is not ideal as it could lead failure in the future where exception message would be modified.
NuGet package version or commit ID: 3.0.2
What's the scenario? When you are creating a new Queue? This isn't supported in any nuget package as of now. Are you referring to the changes in the PR?
My bad, should have provided a scenario. This is not about a queue. In my scenario it was related to creating a Rule with SubscriptionClient
and that rule name was already there.
Repro:
await client.AddRuleAsync(rule).ConfigureAwait(false); // assuming this rule didn't exist before
await client.AddRuleAsync(rule).ConfigureAwait(false); // throws
Forced workaround
try
{
await client.AddRuleAsync(rule).ConfigureAwait(false);
}
catch (ServiceBusException exception) when (exception.Message.Contains("already exists")) // unreliable
{
}