Share via


AspireRabbitMQExtensions.AddRabbitMQClient Method

Definition

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

public static void AddRabbitMQClient (this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Action<Aspire.RabbitMQ.Client.RabbitMQClientSettings>? configureSettings = default, Action<RabbitMQ.Client.ConnectionFactory>? configureConnectionFactory = default);
static member AddRabbitMQClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.RabbitMQ.Client.RabbitMQClientSettings> * Action<RabbitMQ.Client.ConnectionFactory> -> unit
<Extension()>
Public Sub AddRabbitMQClient (builder As IHostApplicationBuilder, connectionName As String, Optional configureSettings As Action(Of RabbitMQClientSettings) = Nothing, Optional configureConnectionFactory As Action(Of ConnectionFactory) = 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<RabbitMQClientSettings>

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

configureConnectionFactory
Action<RabbitMQ.Client.ConnectionFactory>

An optional method that can be used for customizing the RabbitMQ.Client.ConnectionFactory. It's invoked after the options are read from the configuration.

Remarks

Reads the configuration from "Aspire:RabbitMQ:Client" section.

Applies to