AspireNatsClientExtensions.AddNatsClient Method

Definition

Overloads

AddNatsClient(IHostApplicationBuilder, String)

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

AddNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>)

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

AddNatsClient(IHostApplicationBuilder, String, Func<NatsOpts,NatsOpts>)

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

AddNatsClient(IHostApplicationBuilder, String, Func<IServiceProvider,NatsOpts,NatsOpts>)

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

AddNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>, Func<NatsOpts,NatsOpts>)

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

AddNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>, Func<IServiceProvider,NatsOpts,NatsOpts>)

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

AddNatsClient(IHostApplicationBuilder, String)

Source:
AspireNatsClientExtensions.cs

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

C#
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName);

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.

Applies to

.NET Aspire 9.1.0
產品 版本
.NET Aspire 9.1.0

AddNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>)

Source:
AspireNatsClientExtensions.cs

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

C#
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Action<Aspire.NATS.Net.NatsClientSettings>? configureSettings);

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<NatsClientSettings>

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

Applies to

.NET Aspire 9.1.0
產品 版本
.NET Aspire 9.1.0

AddNatsClient(IHostApplicationBuilder, String, Func<NatsOpts,NatsOpts>)

Source:
AspireNatsClientExtensions.cs

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

C#
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Func<NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);

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.

configureOptions
Func<NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>

An optional delegate that can be used for customizing NATS options that aren't exposed as standard configuration.

Applies to

.NET Aspire 9.1.0
產品 版本
.NET Aspire 9.1.0

AddNatsClient(IHostApplicationBuilder, String, Func<IServiceProvider,NatsOpts,NatsOpts>)

Source:
AspireNatsClientExtensions.cs

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

C#
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Func<IServiceProvider,NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);

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.

configureOptions
Func<IServiceProvider,NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>

An optional delegate that can be used for customizing NATS options that aren't exposed as standard configuration.

Applies to

.NET Aspire 9.1.0
產品 版本
.NET Aspire 9.1.0

AddNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>, Func<NatsOpts,NatsOpts>)

Source:
AspireNatsClientExtensions.cs
Source:
AspireNatsClientExtensions.cs
Source:
AspireNatsClientExtensions.cs

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

C#
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Action<Aspire.NATS.Net.NatsClientSettings>? configureSettings = default, Func<NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions = default);
C#
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Action<Aspire.NATS.Net.NatsClientSettings>? configureSettings, Func<NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);

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<NatsClientSettings>

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

configureOptions
Func<NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>

An optional delegate that can be used for customizing NATS options that aren't exposed as standard configuration.

Exceptions

Thrown if mandatory builder is null.

Thrown when mandatory ConnectionString is not provided.

Applies to

.NET Aspire 9.1.0 及其他版本
產品 版本
.NET Aspire 8.0.0, 9.0.0, 9.1.0

AddNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>, Func<IServiceProvider,NatsOpts,NatsOpts>)

Source:
AspireNatsClientExtensions.cs

Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.

C#
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Action<Aspire.NATS.Net.NatsClientSettings>? configureSettings, Func<IServiceProvider,NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);

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<NatsClientSettings>

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

configureOptions
Func<IServiceProvider,NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>

An optional delegate that can be used for customizing NATS options that aren't exposed as standard configuration.

Exceptions

Thrown if mandatory builder is null.

Thrown when mandatory ConnectionString is not provided.

Applies to

.NET Aspire 9.1.0
產品 版本
.NET Aspire 9.1.0