Reputation: 1167
I tried to follow the steps mentioned from Microsoft documentation to set up second ServiceBus to prevent ServiceBus outage.
However, when I run below code, pairing never finishes:
public class ServiceBusContext
{
public ServiceBusContext()
{
var nsManager1 = NamespaceManager.CreateFromConnectionString("...");
var messageFactory1 = MessagingFactory.Create(nsManager1.Address, nsManager1.Settings.TokenProvider);
var nsManager2 = NamespaceManager.CreateFromConnectionString("...");
var messageFactory2 = MessagingFactory.Create(nsManager2.Address, nsManager2.Settings.TokenProvider);
var sendAvailabilityOptions = new SendAvailabilityPairedNamespaceOptions(nsManager2, messageFactory2, 10, TimeSpan.Zero, false);
messageFactory1.PairNamespaceAsync(sendAvailabilityOptions).Wait();
Debug.WriteLine("Cannot reach this code");
}
}
How to setup ServiceBuses with failover feature properly?
Upvotes: 1
Views: 218
Reputation: 25994
While this feature is still available with the old client, I would discourage from using it. Besides a few problematic design issues with the feature, it also doesn't really help with a flow where you need to send and receive. It is only designed for send-only scenario, leveraging fail-over (secondary) namespace as storage. Which inflates the cost in turn as well.
Not to mention that this is a legacy library. The contemporary equivalent is .NET Standard Microsoft.Azure.ServiceBus
library. Instead, it offers Geo-DR feature (Premium only) which is not quite the same, but offers fail-over is trully critical scenarios where your namespace is gone. For other than that, the namespace should be available 24/7. With the additional support for Availability Zones with Service Bus (Premium only), you're getting
financially-backed SLA with fault-isolated locations within an Azure region, providing redundant power, cooling, and networking.
which should remove the need for paired namespaces.
Upvotes: 1