Skip to content

Azure Storage Queues

Installation

bash
dotnet add package Shuttle.Hopper.AzureStorageQueues

In order to make use of the AzureStorageQueue you will need access to an Azure Storage account or use the Azurite emulator for local Azure Storage development.

You may want to take a look at how to get started with Azure Queue storage using .NET.

Configuration

The URI structure is azuresq://configuration-name/queue-name.

If the StorageAccount is not specified then the ConnectionString will be used. At least one of the two is required. When StorageAccount is specified the DefaultAzureCredential will be used to authenticate.

c#
services.AddHopper()
    .UseAzureStorageQueues(builder =>
    {
        builder.Configure("azure", options =>
        {
            options.StorageAccount = "devstoreaccount1";
            options.ConnectionString = "UseDevelopmentStorage=true";
            options.MaxMessages = 20;
            options.VisibilityTimeout = null;
        });
    });

The default JSON settings structure is as follows:

json
{
  "Shuttle": {
    "AzureStorageQueues": {
      "azure": {
        "StorageAccount": "devstoreaccount1",
        "ConnectionString": "UseDevelopmentStorage=true",
        "MaxMessages": 32,
        "VisibilityTimeout": "00:00:30"
      }
    }
  }
}

AzureStorageQueueOptions

Segment / ArgumentDefaultDescription
StorageAccountThe name of the storage account.
ConnectionStringThe Azure Storage Queue endpoint to connect to.
MaxMessages32Specifies the number of messages to fetch from the queue (between 1 and 32).
VisibilityTimeoutnullThe message visibility timeout that will be used for messages that fail processing.
QueueClientnullA QueueClientOptions instance for specific client configuration.