I am using service bus in my system and wants to leverage failover feature of the premium tier service bus https://github.com/Azure/azure-service-bus/tree/master/samples/DotNet/Microsoft.ServiceBus.Messaging/GeoDR/SBGeoDR2/SBGeoDR2 I saw few code samples that can help me execute this but main question is when to execute failover through code, as we are doing it automatically instead of manually.
One solution that I thought out is to use Polly (https://github.com/App-vNext/Polly#retry ) library and use retry for certain exceptions and if retries are unsuccessful then execute failover.
Basically our point is to make service bus highly available in our system, even if service bus is down or throttling for more than 15-30 min, failover should occur.
But what all exceptions are possible on which failover makes sense for service bus.
I listed few exceptions below (https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.servicebus.servicebusexception?view=azure-dotnet) but not sure whether these fit in our scenario. ServerBusyException ServiceBusCommunicationException ServiceBusTimeOutException
In simple words, I would say what exceptions are thrown by servicebus when outage occurs or downtime happens and if we try to call "SendAsync" (https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicebus.messaging.topicclient.sendasync?view=azure-dotnet) method.
https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-outages-disasters.