AspireNatsClientExtensions Methods
Class Methods 13 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) { // ... }}Parameters
builder IHostApplicationBuilder name string 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) { // ... }}Parameters
builder IHostApplicationBuilder name string configureSettings Action<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) { // ... }}Parameters
builder IHostApplicationBuilder name string configureOptions Func<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) { // ... }}Parameters
builder IHostApplicationBuilder name string configureOptions Func<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) { // ... }}Parameters
builder IHostApplicationBuilder name string configureSettings Action<NatsClientSettings> configureOptions Func<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) { // ... }}Parameters
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to. name string The 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. 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, NatsOpts, NatsOpts> An optional delegate that can be used for customizing NATS options that aren't exposed as standard configuration. Exceptions
ArgumentNullException Thrown when builder or name is null. ArgumentException Thrown if mandatory name is empty. InvalidOperationException Thrown 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) { // ... }}Parameters
builder IHostApplicationBuilder connectionName string 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) { // ... }}Parameters
builder IHostApplicationBuilder connectionName string configureSettings Action<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) { // ... }}Parameters
builder IHostApplicationBuilder connectionName string configureOptions Func<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) { // ... }}Parameters
builder IHostApplicationBuilder connectionName string configureOptions Func<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) { // ... }}Parameters
builder IHostApplicationBuilder connectionName string configureSettings Action<NatsClientSettings> configureOptions Func<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) { // ... }}Parameters
builder IHostApplicationBuilder The Hosting.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, NatsOpts, NatsOpts> An optional delegate that can be used for customizing NATS options that aren't exposed as standard configuration. Exceptions
ArgumentNullException Thrown if mandatory builder is null. InvalidOperationException Thrown 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) { // ... }}Parameters
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to. Exceptions
ArgumentNullException Thrown if mandatory builder is null.