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
url
stringNATS server URL to connect to. (default: nats://localhost:4222)
name
stringClient name. (default: NATS .NET Client)
credsFile
stringCredentials 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
opts
NatsOptsNATS client options.
pending
BoundedChannelFullModeSets
SubPendingChannelFullMode
option. (default: wait)