TLDR
If immediate action is not a hard requirement, you can address service unavailability by implementing retry logic when consuming endpoints that do not guarantee availability.
Context
Azure Service Bus is a powerful tool for decoupling applications, especially in microservices architectures. However, choosing the correct tier can be challenging due to significant pricing differences. The Standard tier is cost-effective but can be unstable, while the Premium tier offers excellent availability at a much higher cost.
If availability is important but you can tolerate occasional latency, Durable Functions can help by implementing retry logic. This ensures that messages are sent even if the Service Bus is temporarily unavailable.
Example Code
|
|
In this example:
- The orchestrator retries up to 20 times.
- The first retry occurs after 5 seconds.
- The retry interval triples with each attempt, up to a maximum of 1 minute.
This approach ensures reliable message delivery while using the cost-effective Standard tier.