In the previous post I described how
PopReceipt can be used and provided simple examples. In this post I will continue to work with Azure Storage Queue Service. I am going to describe an important parameter
Refer to previous posts to get started with Azure Storage Queue Service.
QueueRequestOptions is a very important class that are used as parameter of some
CloudStorageQueue methods that interact with Azure Storage Service.
QueueRequestOptions represents a set of timeout and retry policy options that may be specified for a request against Azure Queue Service. Also it specifies encryption settings. Some properties of this class are self-explanatory such as
ServerTimeout, others are not.
RetryPolicy allows you execute some operations repeatedly (i.e. retry those operations) if an error has occurred while executing those operations and certain conditions are met. They also allow you to define how many times the operation should be retried and how much time should your code wait between retries.
RetryPolicy can be one of the following:
NoRetry- a default retry policy. The name speaks for itself.
LinearRetry- represents a retry policy that performs a specified number of retries, using a specified fixed time interval between retries. A default number of retries is 3, a default interval is 30 seconds. This policy can help if you think resource is unavailable because of a transient failure.
ExponentialRetry- represents a retry policy that performs a specified number of retries, using a randomized exponential back off scheme to determine the interval between retries. Default number of retires is 3, default interval is between 3 and 120 seconds. This policy can help if you are fighting with throttling.
Refer to Storage Client Library 2.0 – Implementing Retry Policies for more info.
The next parameter is
MaximumExecutionTime. As name suggests it sets the maximum execution time across all potential retries of a request.
A very interesting parameter is
LocationMode, it allows to specify where request should go, it can be:
PrimaryOnly- default. All requests are always sent to a primary location.
PrimaryThenSecondary- requests are sent to the primary location first, if a request fails, it is sent to a secondary location.
SecondaryOnly- all requests are always sent to a primary location.
SecondaryThenPrimary- requests are sent to the secondary location first, if a request fails, it is sent to a primary location.
Azure Storage Queue Service supports encrypting data within client applications before uploading to Azure Storage, and decrypting data while downloading to the client. The library also supports integration with Azure Key Vault for storage account key management.
RequireEncryption properties can be used to control encryption. Encryption is a very complex topic, I will make a post about Azure Key Vault and an encryption someday.
Azure Storage Queue library is very simplistic, but yet flexible. Developers can specify different request options to control the behaviour. In this post I have described the
QueueRequestOptions class and its parameters. I highlighted basic usage scenarios but didn't provide any code. I have done this because it depends on the use case.