AspireNatsClientExtensions.AddNatsClient Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
Registers NATS.Client.Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName);
static member AddNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string -> unit
<Extension()>
Public Sub AddNatsClient (builder As IHostApplicationBuilder, connectionName As String)
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
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.
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Action<Aspire.NATS.Net.NatsClientSettings>? configureSettings);
static member AddNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.NATS.Net.NatsClientSettings> -> unit
<Extension()>
Public Sub AddNatsClient (builder As IHostApplicationBuilder, connectionName As String, configureSettings As Action(Of NatsClientSettings))
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
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.
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Func<NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);
static member AddNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Func<NATS.Client.Core.NatsOpts, NATS.Client.Core.NatsOpts> -> unit
<Extension()>
Public Sub AddNatsClient (builder As IHostApplicationBuilder, connectionName As String, configureOptions As Func(Of NatsOpts, NatsOpts))
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
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.
public static void AddNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Func<IServiceProvider,NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);
static member AddNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Func<IServiceProvider, NATS.Client.Core.NatsOpts, NATS.Client.Core.NatsOpts> -> unit
<Extension()>
Public Sub AddNatsClient (builder As IHostApplicationBuilder, connectionName As String, configureOptions As Func(Of IServiceProvider, NatsOpts, NatsOpts))
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
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.
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);
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);
static member AddNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.NATS.Net.NatsClientSettings> * Func<NATS.Client.Core.NatsOpts, NATS.Client.Core.NatsOpts> -> unit
<Extension()>
Public Sub AddNatsClient (builder As IHostApplicationBuilder, connectionName As String, Optional configureSettings As Action(Of NatsClientSettings) = Nothing, Optional configureOptions As Func(Of NatsOpts, NatsOpts) = Nothing)
<Extension()>
Public Sub AddNatsClient (builder As IHostApplicationBuilder, connectionName As String, configureSettings As Action(Of NatsClientSettings), configureOptions As Func(Of NatsOpts, NatsOpts))
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
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.
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);
static member AddNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.NATS.Net.NatsClientSettings> * Func<IServiceProvider, NATS.Client.Core.NatsOpts, NATS.Client.Core.NatsOpts> -> unit
<Extension()>
Public Sub AddNatsClient (builder As IHostApplicationBuilder, connectionName As String, configureSettings As Action(Of NatsClientSettings), configureOptions As Func(Of IServiceProvider, NatsOpts, NatsOpts))
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.