C# Azure 设置第二个 ServiceBus 用于故障转移
C# Azure Setup second ServiceBus for failover
我尝试按照 Microsoft documentation to set up second ServiceBus to prevent ServiceBus outage 中提到的步骤进行操作。
但是,当我 运行 下面的代码时,配对永远不会完成:
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");
}
}
如何正确设置具有故障转移功能的 ServiceBuses?
虽然旧客户端仍然可以使用此功能,但我不鼓励使用它。除了该功能的一些有问题的设计问题外,它对需要发送 和 接收的流程也没有真正的帮助。它仅适用于仅发送场景,利用故障转移(辅助)命名空间作为 storage。这反过来也会增加成本。
更不用说这是一个遗留库。当代等效项是 .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),你得到
financially-backed SLA with fault-isolated locations within an Azure region, providing redundant power, cooling, and networking.
这应该消除了对配对命名空间的需要。
我尝试按照 Microsoft documentation to set up second ServiceBus to prevent ServiceBus outage 中提到的步骤进行操作。
但是,当我 运行 下面的代码时,配对永远不会完成:
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");
}
}
如何正确设置具有故障转移功能的 ServiceBuses?
虽然旧客户端仍然可以使用此功能,但我不鼓励使用它。除了该功能的一些有问题的设计问题外,它对需要发送 和 接收的流程也没有真正的帮助。它仅适用于仅发送场景,利用故障转移(辅助)命名空间作为 storage。这反过来也会增加成本。
更不用说这是一个遗留库。当代等效项是 .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),你得到
financially-backed SLA with fault-isolated locations within an Azure region, providing redundant power, cooling, and networking.
这应该消除了对配对命名空间的需要。