AspireNatsClientExtensions.AddKeyedNatsClient 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
AddKeyedNatsClient(IHostApplicationBuilder, String) |
Registers NATS.Client.Core.INatsConnection as a keyed service for given |
AddKeyedNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>) |
Registers NATS.Client.Core.INatsConnection as a keyed service for given |
AddKeyedNatsClient(IHostApplicationBuilder, String, Func<NatsOpts,NatsOpts>) |
Registers NATS.Client.Core.INatsConnection as a keyed service for given |
AddKeyedNatsClient(IHostApplicationBuilder, String, Func<IServiceProvider,NatsOpts,NatsOpts>) |
Registers NATS.Client.Core.INatsConnection as a keyed service for given |
AddKeyedNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>, Func<NatsOpts,NatsOpts>) |
Registers NATS.Client.Core.INatsConnection as a keyed service for given |
AddKeyedNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>, Func<IServiceProvider,NatsOpts,NatsOpts>) |
Registers NATS.Client.Core.INatsConnection as a keyed service for given |
AddKeyedNatsClient(IHostApplicationBuilder, String)
Registers NATS.Client.Core.INatsConnection as a keyed service for given name
for connecting NATS server with NATS client.
Configures health check and logging for the NATS client.
public static void AddKeyedNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name);
static member AddKeyedNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string -> unit
<Extension()>
Public Sub AddKeyedNatsClient (builder As IHostApplicationBuilder, name As String)
Parameters
- builder
- IHostApplicationBuilder
The IHostApplicationBuilder to read config from and add services to.
- name
- String
The name of the component, which is used as the ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
Applies to
AddKeyedNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>)
Registers NATS.Client.Core.INatsConnection as a keyed service for given name
for connecting NATS server with NATS client.
Configures health check and logging for the NATS client.
public static void AddKeyedNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.NATS.Net.NatsClientSettings>? configureSettings);
static member AddKeyedNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.NATS.Net.NatsClientSettings> -> unit
<Extension()>
Public Sub AddKeyedNatsClient (builder As IHostApplicationBuilder, name As String, configureSettings As Action(Of NatsClientSettings))
Parameters
- builder
- IHostApplicationBuilder
The IHostApplicationBuilder to read config from and add services to.
- name
- String
The name of the component, which is used as the ServiceKey of the service and also 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
AddKeyedNatsClient(IHostApplicationBuilder, String, Func<NatsOpts,NatsOpts>)
Registers NATS.Client.Core.INatsConnection as a keyed service for given name
for connecting NATS server with NATS client.
Configures health check and logging for the NATS client.
public static void AddKeyedNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Func<NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);
static member AddKeyedNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Func<NATS.Client.Core.NatsOpts, NATS.Client.Core.NatsOpts> -> unit
<Extension()>
Public Sub AddKeyedNatsClient (builder As IHostApplicationBuilder, name As String, configureOptions As Func(Of NatsOpts, NatsOpts))
Parameters
- builder
- IHostApplicationBuilder
The IHostApplicationBuilder to read config from and add services to.
- name
- String
The name of the component, which is used as the ServiceKey of the service and also 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
AddKeyedNatsClient(IHostApplicationBuilder, String, Func<IServiceProvider,NatsOpts,NatsOpts>)
Registers NATS.Client.Core.INatsConnection as a keyed service for given name
for connecting NATS server with NATS client.
Configures health check and logging for the NATS client.
public static void AddKeyedNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Func<IServiceProvider,NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);
static member AddKeyedNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Func<IServiceProvider, NATS.Client.Core.NatsOpts, NATS.Client.Core.NatsOpts> -> unit
<Extension()>
Public Sub AddKeyedNatsClient (builder As IHostApplicationBuilder, name As String, configureOptions As Func(Of IServiceProvider, NatsOpts, NatsOpts))
Parameters
- builder
- IHostApplicationBuilder
The IHostApplicationBuilder to read config from and add services to.
- name
- String
The name of the component, which is used as the ServiceKey of the service and also 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
AddKeyedNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>, Func<NatsOpts,NatsOpts>)
Registers NATS.Client.Core.INatsConnection as a keyed service for given name
for connecting NATS server with NATS client.
Configures health check and logging for the NATS client.
public static void AddKeyedNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.NATS.Net.NatsClientSettings>? configureSettings = default, Func<NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions = default);
public static void AddKeyedNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.NATS.Net.NatsClientSettings>? configureSettings, Func<NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);
static member AddKeyedNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.NATS.Net.NatsClientSettings> * Func<NATS.Client.Core.NatsOpts, NATS.Client.Core.NatsOpts> -> unit
<Extension()>
Public Sub AddKeyedNatsClient (builder As IHostApplicationBuilder, name As String, Optional configureSettings As Action(Of NatsClientSettings) = Nothing, Optional configureOptions As Func(Of NatsOpts, NatsOpts) = Nothing)
<Extension()>
Public Sub AddKeyedNatsClient (builder As IHostApplicationBuilder, name 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.
- name
- String
The name of the component, which is used as the ServiceKey of the service and also 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 when builder
or name
is null.
Thrown if mandatory name
is empty.
Thrown when mandatory ConnectionString is not provided.
Applies to
AddKeyedNatsClient(IHostApplicationBuilder, String, Action<NatsClientSettings>, Func<IServiceProvider,NatsOpts,NatsOpts>)
Registers NATS.Client.Core.INatsConnection as a keyed service for given name
for connecting NATS server with NATS client.
Configures health check and logging for the NATS client.
public static void AddKeyedNatsClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.NATS.Net.NatsClientSettings>? configureSettings, Func<IServiceProvider,NATS.Client.Core.NatsOpts,NATS.Client.Core.NatsOpts>? configureOptions);
static member AddKeyedNatsClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.NATS.Net.NatsClientSettings> * Func<IServiceProvider, NATS.Client.Core.NatsOpts, NATS.Client.Core.NatsOpts> -> unit
<Extension()>
Public Sub AddKeyedNatsClient (builder As IHostApplicationBuilder, name 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.
- name
- String
The name of the component, which is used as the ServiceKey of the service and also 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 when builder
or name
is null.
Thrown if mandatory name
is empty.
Thrown when mandatory ConnectionString is not provided.