Andrew Davis
Andrew Davis

Reputation: 480

Using Azure Table Storage's retry policy with Azure Functions

I'm trying to put together an API using Azure Functions and store its data in Table Storage. I have all this working, but I want to implement the retry policies which the Azure Storage Client provides.

Does anyone know if this is implemented 'behind the scenes' or is there some code I need add to the binding that passes the CloudTable into the function.

Thanks for your help.

Upvotes: 0

Views: 1340

Answers (2)

Ciaran
Ciaran

Reputation: 573

I would go with Polly as you suggested. It's awesome. See my answer to a similar query here: Read retry on Azure Table which should give you a good idea as to implementation.

Upvotes: 0

Brando Zhang
Brando Zhang

Reputation: 28432

As far as I know, all operations against Windows Azure Storage are REST based operations over HTTP, all requests (successful or failed) return a HTTP status code.

So in case of a failed request, retry policy code block intercepts the exception and inspects the HTTP status code (and also the error code returned by storage service) and based on that determines if the request should be retried or not.

So if you want to achieve the retry police in the azure function, you could just use try catch to catch the HTTP status code and write your own logic to retry.

Upvotes: 0

Related Questions