NATS .NET Client
1.0.4
The NATS.io .NET C# Client
|
Public Member Functions | |
void | SetUserCredentials (string credentialsPath, string privateKeyPath) |
void | SetUserCredentials (string credentialsPath) |
void | SetUserCredentialHandlers (EventHandler< UserJWTEventArgs > userJWTEventHandler, EventHandler< UserSignatureEventArgs > userSignatureEventHandler) |
void | SetNkey (string publicNkey, EventHandler< UserSignatureEventArgs > userSignatureEventHandler) |
void | SetNkey (string publicNkey, string privateKeyPath) |
void | SetJWTEventHandlers (EventHandler< UserJWTEventArgs > JWTEventHandler, EventHandler< UserSignatureEventArgs > SignatureEventHandler) |
void | AddCertificate (string fileName) |
void | AddCertificate (X509Certificate2 certificate) |
void | SetReconnectJitter (int jitter, int tlsJitter) |
override string | ToString () |
Public Attributes | |
EventHandler< ConnEventArgs > | ClosedEventHandler |
EventHandler< ConnEventArgs > | ServerDiscoveredEventHandler |
EventHandler< ConnEventArgs > | DisconnectedEventHandler |
EventHandler< ConnEventArgs > | ReconnectedEventHandler |
EventHandler< ErrEventArgs > | AsyncErrorEventHandler |
EventHandler< ConnEventArgs > | LameDuckModeEventHandler |
EventHandler< ReconnectDelayEventArgs > | ReconnectDelayHandler |
EventHandler< HeartbeatAlarmEventArgs > | HeartbeatAlarmEventHandler |
EventHandler< UnhandledStatusEventArgs > | UnhandledStatusEventHandler |
EventHandler< StatusEventArgs > | PullStatusWarningEventHandler |
EventHandler< StatusEventArgs > | PullStatusErrorEventHandler |
EventHandler< FlowControlProcessedEventArgs > | FlowControlProcessedEventHandler |
RemoteCertificateValidationCallback | TLSRemoteCertificationValidationCallback |
Static Public Attributes | |
static int | ReconnectForever = -1 |
static readonly int | ReconnectBufferSizeUnbounded = 0 |
static readonly int | ReconnectBufferDisabled = -1 |
Properties | |
string | Url [get, set] |
string[] | Servers [get, set] |
bool | NoRandomize [get, set] |
string | Name [get, set] |
bool | Verbose [get, set] |
bool | Pedantic [get, set] |
bool | UseOldRequestStyle [get, set] |
bool | Secure [get, set] |
bool | AllowReconnect [get, set] |
int | MaxReconnect [get, set] |
int | ReconnectWait [get, set] |
int | PingInterval [get, set] |
int | Timeout [get, set] |
int | MaxPingsOut [get, set] |
int | SubChannelLength [get, set] |
string | User [get, set] |
string | Password [set] |
string | Token [get, set] |
string | CustomInboxPrefix [get, set] |
int | SubscriberDeliveryTaskCount [get, set] |
int | SubscriptionBatchSize [get, set] |
bool | NoEcho [get, set] |
bool | IgnoreDiscoveredServers [get, set] |
int | ReconnectBufferSize [get, set] |
int | ReconnectJitter [get] |
int | ReconnectJitterTLS [get] |
bool | CheckCertificateRevocation = true [get, set] |
This class is used to setup all NATs client options.
void NATS.Client.Options.AddCertificate | ( | string | fileName | ) |
Adds an X.509 certificate from a file for use with a secure connection.
fileName | Path to the certificate file to add. |
ArgumentNullException | fileName is null . |
System.Security.Cryptography.CryptographicException | An error with the certificate occurred. For example:
|
void NATS.Client.Options.AddCertificate | ( | X509Certificate2 | certificate | ) |
Adds an X.509 certificate for use with a secure connection.
certificate | An X.509 certificate represented as an X509Certificate2 object. |
ArgumentNullException | certificate is null . |
System.Security.Cryptography.CryptographicException | An error with the certificate occurred. For example:
|
void NATS.Client.Options.SetJWTEventHandlers | ( | EventHandler< UserJWTEventArgs > | JWTEventHandler, |
EventHandler< UserSignatureEventArgs > | SignatureEventHandler | ||
) |
Sets a custom JWT Event Handler and Signature handler.
JWTEventHandler | |
SignatureEventHandler |
void NATS.Client.Options.SetNkey | ( | string | publicNkey, |
EventHandler< UserSignatureEventArgs > | userSignatureEventHandler | ||
) |
SetNkey will set the public Nkey and the signature callback to sign the server nonce.
publicNkey | The User's public Nkey |
userSignatureEventHandler | A User signature Event Handler to sign the server nonce. |
void NATS.Client.Options.SetNkey | ( | string | publicNkey, |
string | privateKeyPath | ||
) |
SetNkey will set the public Nkey and the signature callback to sign the server nonce.
publicNkey | The User's public Nkey |
privateKeyPath | A path to a file containing the private Nkey. |
void NATS.Client.Options.SetReconnectJitter | ( | int | jitter, |
int | tlsJitter | ||
) |
Sets the the upper bound for a random delay in milliseconds added to ReconnectWait during a reconnect for clear and TLS connections.
Defaults are 100 ms and 1s for TLS.
void NATS.Client.Options.SetUserCredentialHandlers | ( | EventHandler< UserJWTEventArgs > | userJWTEventHandler, |
EventHandler< UserSignatureEventArgs > | userSignatureEventHandler | ||
) |
SetUserJWT will set the callbacks to retrieve the user's JWT and the signature callback to sign the server nonce. This an the Nkey option are mutually exclusive.
userJWTEventHandler | A User JWT Event Handler |
userSignatureEventHandler | A User signature Event Handler |
void NATS.Client.Options.SetUserCredentials | ( | string | credentialsPath | ) |
Sets user credentials using the NATS 2.0 security scheme.
credentialsPath | A chained credentials file, e.g user.cred |
void NATS.Client.Options.SetUserCredentials | ( | string | credentialsPath, |
string | privateKeyPath | ||
) |
Sets user credentials using the NATS 2.0 security scheme.
credentialsPath | A user JWT, e.g user.jwt |
privateKeyPath | Private Key file |
override string NATS.Client.Options.ToString | ( | ) |
Returns a string representation of the value of this Options instance.
EventHandler<ConnEventArgs> NATS.Client.Options.LameDuckModeEventHandler |
Represents the method that will handle an event raised when the server notifies the connection that it entered lame duck mode.
A server in lame duck mode will gradually disconnect all its connections before shuting down. This is often used in deployments when upgrading NATS Servers.
|
static |
Constant that disables the reconnect buffer.
|
static |
Constant used to sets the reconnect buffer size to unbounded.
EventHandler<ReconnectDelayEventArgs> NATS.Client.Options.ReconnectDelayHandler |
Represents the optional method that is used to get from the user the desired delay the client should pause before attempting to reconnect again.
Note that this is invoked after the library tried the entire list of URLs and failed to reconnect. By default, the client will use the sum of ReconnectWait and a random value between zero and Options.ReconnectJitter or Options.ReconnectJitterTLS
RemoteCertificateValidationCallback NATS.Client.Options.TLSRemoteCertificationValidationCallback |
Overrides the default NATS RemoteCertificationValidationCallback.
The default callback simply checks if there were any protocol errors. Overriding this callback is useful during testing, or accepting self signed certificates.
|
getset |
Get or set whether to check Certificate Revocation when connecting via TLS
|
getset |
Gets or sets the interval, in milliseconds, pings will be sent to the server.
Take care to coordinate this value with the server's interval.
|
getset |
Gets or sets the buffer size of messages kept while busy reconnecting.
When reconnecting, the NATS client will hold published messages that will be flushed to the new server upon a successful reconnect. The default is buffer size is 8 MB. This buffering can be disabled.
|
get |
Get the the upper bound for a random delay added to ReconnectWait during a reconnect for connections.
|
get |
Get the the upper bound for a random delay added to ReconnectWait during a reconnect for TLS connections.
|
getset |
Gets or sets the array of servers that the NATS client will connect to.
The individual URLs may contain username/password information.
|
getset |
Gets or sets the number of long running tasks to deliver messages to asynchronous subscribers. The default is zero (0
) indicating each asynchronous subscriber has its own channel and task created to deliver messages.
The default where each subscriber has a delivery task is very performant, but does not scale well when large numbers of subscribers are required in an application. Setting this value will limit the number of subscriber channels to the specified number of long running tasks. These tasks will process messages for ALL asynchronous subscribers rather than one task for each subscriber.
Delivery order by subscriber is still guaranteed. The shared message processing channels are still each bounded by the SubChannelLength option. Note, slow subscriber errors will flag the last subscriber processed in the tasks, which may not actually be the slowest subscriber.
|
getset |
Gets or sets the batch size for calling subscription handlers.
When delivering messages to the subscriber, the batch size determines how many messages could be retrieved from the internal subscription queue at one time. This can allow higher performance from a single subscriber by avoiding the locking overhead of one-at-a-time retrieval from the queue.
|
getset |
Gets or sets the url used to connect to the NATs server.
This may contain username/password information.
|
getset |
Gets or sets a value indicating whether or not the old request pattern should be used.
The old request pattern involved a separate subscription per request inbox. The new style (default) involves creating a single inbox subscription per connection, upon the first request, and mapping outbound requests over that one subscription.