Share via


AspireQueueStorageExtensions.AddAzureQueueClient Method

Definition

Registers QueueServiceClient as a singleton in the services provided by the builder. Enables retries, corresponding health check, logging and telemetry.

public static void AddAzureQueueClient (this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Action<Aspire.Azure.Storage.Queues.AzureStorageQueuesSettings>? configureSettings = default, Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Storage.Queues.QueueServiceClient,Azure.Storage.Queues.QueueClientOptions>>? configureClientBuilder = default);
static member AddAzureQueueClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.Azure.Storage.Queues.AzureStorageQueuesSettings> * Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Storage.Queues.QueueServiceClient, Azure.Storage.Queues.QueueClientOptions>> -> unit
<Extension()>
Public Sub AddAzureQueueClient (builder As IHostApplicationBuilder, connectionName As String, Optional configureSettings As Action(Of AzureStorageQueuesSettings) = Nothing, Optional configureClientBuilder As Action(Of IAzureClientBuilder(Of QueueServiceClient, QueueClientOptions)) = Nothing)

Parameters

builder
IHostApplicationBuilder

The IHostApplicationBuilder to read config from and add services to.

connectionName
String

A name used to retrieve the connection string from the ConnectionStrings configuration section.

configureSettings
Action<AzureStorageQueuesSettings>

An optional method that can be used for customizing the AzureStorageQueuesSettings. It's invoked after the settings are read from the configuration.

configureClientBuilder
Action<IAzureClientBuilder<QueueServiceClient,QueueClientOptions>>

An optional method that can be used for customizing the IAzureClientBuilder<TClient,TOptions>.

Exceptions

Thrown when neither ConnectionString nor ServiceUri is provided.

Remarks

Reads the configuration from "Aspire:Azure:Storage:Queues" section.

Applies to