"This sample shows how to handle transient connection failures in SQL Azure.
The Windows Azure AppFabric Customer Advisory Team (CAT) has developed a library that encapsulates retry logic for SQL Azure, Windows Azure storage, and AppFabric Service Bus. Using this library, you decide which errors should trigger a retry attempt, and the library handles the retry logic.
This sample assumes you have a Windows Azure Platform subscription. The sample requires Visual Studio 2010 Professional or higher.
A tutorial describing this sample in more detail can be found at TechNet Wiki.
"This tutorial shows how to handle transient connection failures in SQL Azure.
SQL Azure queries can fail for various reasons – a malformed query, network issues, and so on. Some errors are transient, meaning the problem often goes away by itself. For this subset of errors, it makes sense to retry the query after a short interval. If the query still fails after several retries, you would report an error. Of course, not all errors are transient. SQL Error 102, “Incorrect syntax,” won’t go away no matter how many times you submit the same query. In short, implementing robust retry logic requires some thought.
Testing retry logic is an interesting problem, because you need to trigger transient errors in a repeatable way. Of course, you could just unplug your network cable, or block port 1433. (SQL Azure uses TCP over port 1433.) But for this tutorial, I’ve opted for something that’s easier to code: Before submitting a query, hold a table-wide lock, which causes a deadlock or a timeout. When the lock is released, the original query can be retried.
This tutorial assumes you have a Windows Azure Platform subscription. For more information on creating a subscription, see Getting Started with SQL Azure using the Windows Azure Platform Management Portal.
This tutorial requires Visual Studio 2010 Professional or higher.
- Lesson 1: Create the Example Database
- Lesson 2: Add Queries
- Lesson 3: Add Retry Logic
A nice article and library to help solve a common cloud issue, transient connectivity issues. Don't reinvent the retry wheel if you don't have too...