Constructor NatsClient
NatsClient(string, string, string?)
Initializes a new instance of the NatsClient class.
public NatsClient(string url = "nats://localhost:4222", string name = "NATS .NET Client", string? credsFile = null)
Parameters
urlstringNATS server URL to connect to. (default: nats://localhost:4222)
namestringClient name. (default: NATS .NET Client)
credsFilestringCredentials filepath.
Remarks
You can set more than one server as seed servers in a comma-separated list in the url.
The client will randomly select a server from the list to connect.
User-password or token authentication can be set in the url.
For example, nats://derek:s3cr3t@localhost:4222 or nats://token@localhost:4222.
You should URL-encode the username and password or token if they contain special characters.
If multiple servers are specified and user-password or token authentication is used in the url,
only the credentials in the first server URL will be used; credentials in the remaining server
URLs will be ignored.
NatsClient(NatsOpts, BoundedChannelFullMode)
Initializes a new instance of the NatsClient class.
public NatsClient(NatsOpts opts, BoundedChannelFullMode pending = BoundedChannelFullMode.Wait)
Parameters
optsNatsOptsNATS client options.
pendingBoundedChannelFullModeSets
SubPendingChannelFullModeoption. (default: wait)