Method AddNats
AddNats(IServiceCollection, int, Func<NatsOpts, NatsOpts>?, Action<NatsConnection>?)
Add NatsConnection/Pool to ServiceCollection. When poolSize = 1, registered NatsConnection
and INatsConnection
as singleton.
Others, registered NatsConnectionPool
as singleton, NatsConnection
and INatsConnection
as transient(get from pool).
public static IServiceCollection AddNats(this IServiceCollection services, int poolSize = 1, Func<NatsOpts, NatsOpts>? configureOpts = null, Action<NatsConnection>? configureConnection = null)
Parameters
services
IServiceCollectionpoolSize
intconfigureOpts
Func<NatsOpts, NatsOpts>configureConnection
Action<NatsConnection>