Skip to content
DocsTry Aspire
DocsTry

AspireNatsClientExtensions Methods

ClassMethods13 members
Extension methods for connecting NATS server with NATS client
AddKeyedNatsClient(IHostApplicationBuilder, string)Section titled AddKeyedNatsClient(IHostApplicationBuilder, string)extension
public static class AspireNatsClientExtensions
{
public static void AddKeyedNatsClient(
this IHostApplicationBuilder builder,
string name)
{
// ...
}
}
builderIHostApplicationBuilder
namestring
AddKeyedNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>)Section titled AddKeyedNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>)extension
public static class AspireNatsClientExtensions
{
public static void AddKeyedNatsClient(
this IHostApplicationBuilder builder,
string name,
Action<NatsClientSettings>? configureSettings)
{
// ...
}
}
builderIHostApplicationBuilder
namestring
configureSettingsAction<NatsClientSettings>
AddKeyedNatsClient(IHostApplicationBuilder, string, Func<NatsOpts, NatsOpts>)Section titled AddKeyedNatsClient(IHostApplicationBuilder, string, Func<NatsOpts, NatsOpts>)extension
public static class AspireNatsClientExtensions
{
public static void AddKeyedNatsClient(
this IHostApplicationBuilder builder,
string name,
Func<NatsOpts, NatsOpts>? configureOptions)
{
// ...
}
}
builderIHostApplicationBuilder
namestring
configureOptionsFunc<NatsOpts, NatsOpts>
AddKeyedNatsClient(IHostApplicationBuilder, string, Func<IServiceProvider, NatsOpts, NatsOpts>)Section titled AddKeyedNatsClient(IHostApplicationBuilder, string, Func<IServiceProvider, NatsOpts, NatsOpts>)extension
public static class AspireNatsClientExtensions
{
public static void AddKeyedNatsClient(
this IHostApplicationBuilder builder,
string name,
Func<IServiceProvider, NatsOpts, NatsOpts>? configureOptions)
{
// ...
}
}
builderIHostApplicationBuilder
namestring
configureOptionsFunc<IServiceProvider, NatsOpts, NatsOpts>
AddKeyedNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>, Func<NatsOpts, NatsOpts>)Section titled AddKeyedNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>, Func<NatsOpts, NatsOpts>)extension
public static class AspireNatsClientExtensions
{
public static void AddKeyedNatsClient(
this IHostApplicationBuilder builder,
string name,
Action<NatsClientSettings>? configureSettings,
Func<NatsOpts, NatsOpts>? configureOptions)
{
// ...
}
}
builderIHostApplicationBuilder
namestring
configureSettingsAction<NatsClientSettings>
configureOptionsFunc<NatsOpts, NatsOpts>
AddKeyedNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>, Func<IServiceProvider, NatsOpts, NatsOpts>)Section titled AddKeyedNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>, Func<IServiceProvider, NatsOpts, NatsOpts>)extension
Registers 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 class AspireNatsClientExtensions
{
public static void AddKeyedNatsClient(
this IHostApplicationBuilder builder,
string name,
Action<NatsClientSettings>? configureSettings,
Func<IServiceProvider, NatsOpts, NatsOpts>? configureOptions)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
namestringThe name of the component, which is used as the ServiceDescriptor.ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<NatsClientSettings>An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
configureOptionsFunc<IServiceProvider, NatsOpts, NatsOpts>An optional delegate that can be used for customizing NATS options that aren't exposed as standard configuration.
ArgumentNullExceptionThrown when builder or name is null.
ArgumentExceptionThrown if mandatory name is empty.
InvalidOperationExceptionThrown when mandatory NatsClientSettings.ConnectionString is not provided.
AddNatsClient(IHostApplicationBuilder, string)Section titled AddNatsClient(IHostApplicationBuilder, string)extension
public static class AspireNatsClientExtensions
{
public static void AddNatsClient(
this IHostApplicationBuilder builder,
string connectionName)
{
// ...
}
}
builderIHostApplicationBuilder
connectionNamestring
AddNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>)Section titled AddNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>)extension
public static class AspireNatsClientExtensions
{
public static void AddNatsClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<NatsClientSettings>? configureSettings)
{
// ...
}
}
builderIHostApplicationBuilder
connectionNamestring
configureSettingsAction<NatsClientSettings>
AddNatsClient(IHostApplicationBuilder, string, Func<NatsOpts, NatsOpts>)Section titled AddNatsClient(IHostApplicationBuilder, string, Func<NatsOpts, NatsOpts>)extension
public static class AspireNatsClientExtensions
{
public static void AddNatsClient(
this IHostApplicationBuilder builder,
string connectionName,
Func<NatsOpts, NatsOpts>? configureOptions)
{
// ...
}
}
builderIHostApplicationBuilder
connectionNamestring
configureOptionsFunc<NatsOpts, NatsOpts>
AddNatsClient(IHostApplicationBuilder, string, Func<IServiceProvider, NatsOpts, NatsOpts>)Section titled AddNatsClient(IHostApplicationBuilder, string, Func<IServiceProvider, NatsOpts, NatsOpts>)extension
public static class AspireNatsClientExtensions
{
public static void AddNatsClient(
this IHostApplicationBuilder builder,
string connectionName,
Func<IServiceProvider, NatsOpts, NatsOpts>? configureOptions)
{
// ...
}
}
builderIHostApplicationBuilder
connectionNamestring
configureOptionsFunc<IServiceProvider, NatsOpts, NatsOpts>
AddNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>, Func<NatsOpts, NatsOpts>)Section titled AddNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>, Func<NatsOpts, NatsOpts>)extension
public static class AspireNatsClientExtensions
{
public static void AddNatsClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<NatsClientSettings>? configureSettings,
Func<NatsOpts, NatsOpts>? configureOptions)
{
// ...
}
}
builderIHostApplicationBuilder
connectionNamestring
configureSettingsAction<NatsClientSettings>
configureOptionsFunc<NatsOpts, NatsOpts>
AddNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>, Func<IServiceProvider, NatsOpts, NatsOpts>)Section titled AddNatsClient(IHostApplicationBuilder, string, Action<NatsClientSettings>, Func<IServiceProvider, NatsOpts, NatsOpts>)extension
Registers Core.INatsConnection service for connecting NATS server with NATS client. Configures health check and logging for the NATS client.
public static class AspireNatsClientExtensions
{
public static void AddNatsClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<NatsClientSettings>? configureSettings,
Func<IServiceProvider, NatsOpts, NatsOpts>? configureOptions)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<NatsClientSettings>An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
configureOptionsFunc<IServiceProvider, NatsOpts, NatsOpts>An optional delegate that can be used for customizing NATS options that aren't exposed as standard configuration.
ArgumentNullExceptionThrown if mandatory builder is null.
InvalidOperationExceptionThrown when mandatory NatsClientSettings.ConnectionString is not provided.
AddNatsJetStream(IHostApplicationBuilder)Section titled AddNatsJetStream(IHostApplicationBuilder)extension
Registers JetStream.INatsJSContext service for NATS JetStream operations.
public static class AspireNatsClientExtensions
{
public static void AddNatsJetStream(
this IHostApplicationBuilder builder)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
ArgumentNullExceptionThrown if mandatory builder is null.