NATS .NET Client
1.1.4
The NATS.io .NET C# Client
|
Public Member Functions | |
void | Publish (string subject, byte[] data) |
void | Publish (string subject, MsgHeader headers, byte[] data) |
void | Publish (string subject, byte[] data, int offset, int count) |
void | Publish (string subject, MsgHeader headers, byte[] data, int offset, int count) |
void | Publish (string subject, string reply, byte[] data) |
void | Publish (string subject, string reply, MsgHeader headers, byte[] data) |
void | Publish (string subject, string reply, byte[] data, int offset, int count) |
void | Publish (string subject, string reply, MsgHeader headers, byte[] data, int offset, int count) |
void | Publish (Msg msg) |
Msg | Request (string subject, byte[] data, int timeout) |
Msg | Request (string subject, MsgHeader headers, byte[] data, int timeout) |
Msg | Request (string subject, byte[] data, int offset, int count, int timeout) |
Msg | Request (string subject, MsgHeader headers, byte[] data, int offset, int count, int timeout) |
Msg | Request (string subject, byte[] data) |
Msg | Request (string subject, MsgHeader headers, byte[] data) |
Msg | Request (string subject, byte[] data, int offset, int count) |
Msg | Request (string subject, MsgHeader headers, byte[] data, int offset, int count) |
Msg | Request (Msg message) |
Msg | Request (Msg message, int timeout) |
Task< Msg > | RequestAsync (string subject, byte[] data, int timeout) |
Task< Msg > | RequestAsync (string subject, MsgHeader headers, byte[] data, int timeout) |
Task< Msg > | RequestAsync (string subject, byte[] data, int offset, int count, int timeout) |
Task< Msg > | RequestAsync (string subject, MsgHeader headers, byte[] data, int offset, int count, int timeout) |
Task< Msg > | RequestAsync (string subject, byte[] data) |
Task< Msg > | RequestAsync (string subject, MsgHeader headers, byte[] data) |
Task< Msg > | RequestAsync (string subject, byte[] data, int offset, int count) |
Task< Msg > | RequestAsync (string subject, MsgHeader headers, byte[] data, int offset, int count) |
Task< Msg > | RequestAsync (string subject, byte[] data, int timeout, CancellationToken token) |
Task< Msg > | RequestAsync (string subject, MsgHeader headers, byte[] data, int timeout, CancellationToken token) |
Task< Msg > | RequestAsync (string subject, byte[] data, CancellationToken token) |
Task< Msg > | RequestAsync (string subject, MsgHeader headers, byte[] data, CancellationToken token) |
Task< Msg > | RequestAsync (string subject, byte[] data, int offset, int count, CancellationToken token) |
Task< Msg > | RequestAsync (string subject, MsgHeader headers, byte[] data, int offset, int count, CancellationToken token) |
Task< Msg > | RequestAsync (Msg message) |
Task< Msg > | RequestAsync (Msg message, int timeout) |
Task< Msg > | RequestAsync (Msg message, CancellationToken token) |
Task< Msg > | RequestAsync (Msg message, int timeout, CancellationToken token) |
string | NewInbox () |
ISyncSubscription | SubscribeSync (string subject) |
IAsyncSubscription | SubscribeAsync (string subject) |
IAsyncSubscription | SubscribeAsync (string subject, EventHandler< MsgHandlerEventArgs > handler) |
ISyncSubscription | SubscribeSync (string subject, string queue) |
IAsyncSubscription | SubscribeAsync (string subject, string queue) |
IAsyncSubscription | SubscribeAsync (string subject, string queue, EventHandler< MsgHandlerEventArgs > handler) |
void | Flush (int timeout) |
TimeSpan | RTT () |
void | Flush () |
void | FlushBuffer () |
void | Close () |
bool | IsClosed () |
bool | IsReconnecting () |
void | ResetStats () |
Task | DrainAsync () |
Task | DrainAsync (int timeout) |
void | Drain () |
void | Drain (int timeout) |
bool | IsDraining () |
IStreamContext | GetStreamContext (string streamName) |
IStreamContext | GetStreamContext (string streamName, JetStreamOptions options) |
IConsumerContext | GetConsumerContext (string streamName, string consumerName) |
IConsumerContext | GetConsumerContext (string streamName, string consumerName, JetStreamOptions options) |
IJetStream | CreateJetStreamContext (JetStreamOptions options=null) |
IJetStreamManagement | CreateJetStreamManagementContext (JetStreamOptions options=null) |
IKeyValue | CreateKeyValueContext (string bucketName, KeyValueOptions options=null) |
IKeyValueManagement | CreateKeyValueManagementContext (KeyValueOptions options=null) |
IObjectStore | CreateObjectStoreContext (string bucketName, ObjectStoreOptions options=null) |
IObjectStoreManagement | CreateObjectStoreManagementContext (ObjectStoreOptions options=null) |
Properties | |
Options | Opts [get] |
IPAddress | ClientIP [get] |
int | ClientID [get] |
string | ConnectedUrl [get] |
string | ConnectedId [get] |
ServerInfo | ServerInfo [get] |
string[] | Servers [get] |
string[] | DiscoveredServers [get] |
Exception | LastError [get] |
ConnState | State [get] |
IStatistics | Stats [get] |
long | MaxPayload [get] |
int | SubscriptionCount [get] |
Represents a connection to the NATS server.
void NATS.Client.IConnection.Close | ( | ) |
Closes the IConnection and all associated subscriptions.
Implemented in NATS.Client.Connection.
IJetStream NATS.Client.IConnection.CreateJetStreamContext | ( | JetStreamOptions | options = null | ) |
Gets a context for publishing and subscribing to subjects backed by Jetstream streams and consumers.
options | Optional JetStream options. |
Implemented in NATS.Client.Connection.
IJetStreamManagement NATS.Client.IConnection.CreateJetStreamManagementContext | ( | JetStreamOptions | options = null | ) |
Gets a context for administrating JetStream.
options | Optional JetStream options. |
Implemented in NATS.Client.Connection.
IKeyValue NATS.Client.IConnection.CreateKeyValueContext | ( | string | bucketName, |
KeyValueOptions | options = null |
||
) |
Gets a context for a Key Value bucket
bucketName | The name of the bucket |
options | Optional KeyValueOptions. |
Implemented in NATS.Client.Connection.
IKeyValueManagement NATS.Client.IConnection.CreateKeyValueManagementContext | ( | KeyValueOptions | options = null | ) |
Gets a context for administrating Key Value buckets
options | Optional KeyValueOptions. |
Implemented in NATS.Client.Connection.
IObjectStore NATS.Client.IConnection.CreateObjectStoreContext | ( | string | bucketName, |
ObjectStoreOptions | options = null |
||
) |
Gets a context for a Object Store OBJECT STORE IMPLEMENTATION IS EXPERIMENTAL AND SUBJECT TO CHANGE.
bucketName | The name of the bucket |
options | Optional ObjectStoreOptions. |
Implemented in NATS.Client.Connection.
IObjectStoreManagement NATS.Client.IConnection.CreateObjectStoreManagementContext | ( | ObjectStoreOptions | options = null | ) |
Gets a context for administrating Object Stores OBJECT STORE IMPLEMENTATION IS EXPERIMENTAL AND SUBJECT TO CHANGE.
options | Optional ObjectStoreOptions. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Drain | ( | ) |
Drains a connection for graceful shutdown.
Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages. Upon draining of the publishers, the connection will be closed. Use the Options.ClosedEventHandler option to know when the connection has moved from draining to closed.
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Drain | ( | int | timeout | ) |
Drains a connection for graceful shutdown.
Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages. Upon draining of the publishers, the connection will be closed. Use the Options.ClosedEventHandler option to know when the connection has moved from draining to closed.
timeout | The duration to wait before draining. |
Implemented in NATS.Client.Connection.
Task NATS.Client.IConnection.DrainAsync | ( | ) |
Drains a connection for graceful shutdown.
Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages. Upon draining of the publishers, the connection will be closed. Use the Options.ClosedEventHandler option to know when the connection has moved from draining to closed.
Implemented in NATS.Client.Connection.
Task NATS.Client.IConnection.DrainAsync | ( | int | timeout | ) |
Drains a connection for graceful shutdown.
Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages. Upon draining of the publishers, the connection will be closed. Use the Options.ClosedEventHandler option to know when the connection has moved from draining to closed.
timeout | The duration to wait for the drain to complete. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Flush | ( | int | timeout | ) |
Performs a round trip to the server and returns when it receives the internal reply, or throws a NATSTimeoutException exception if the NATS Server does not reply in time.
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.FlushBuffer | ( | ) |
Immediately flushes the underlying connection buffer if the connection is valid.
NATSConnectionClosedException | The Connection is closed. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
Implemented in NATS.Client.Connection.
IConsumerContext NATS.Client.IConnection.GetConsumerContext | ( | string | streamName, |
string | consumerName | ||
) |
Get a consumer context for a specific named stream and specific named consumer. Verifies that the stream and consumer exist.
streamName | the name of the stream |
consumerName | the name of the consumer |
Implemented in NATS.Client.Connection.
IConsumerContext NATS.Client.IConnection.GetConsumerContext | ( | string | streamName, |
string | consumerName, | ||
JetStreamOptions | options | ||
) |
Get a consumer context for a specific named stream and specific named consumer. Verifies that the stream and consumer exist.
streamName | the name of the stream |
consumerName | the name of the consumer |
options | JetStream options. |
Implemented in NATS.Client.Connection.
IStreamContext NATS.Client.IConnection.GetStreamContext | ( | string | streamName | ) |
Get a stream context for a specific stream.
streamName | the stream for the context |
a StreamContext instance.
an IStreamContext instance
Implemented in NATS.Client.Connection.
IStreamContext NATS.Client.IConnection.GetStreamContext | ( | string | streamName, |
JetStreamOptions | options | ||
) |
Gets a stream context.
streamName | the stream for the context |
options | JetStream options. |
Implemented in NATS.Client.Connection.
bool NATS.Client.IConnection.IsClosed | ( | ) |
Returns a value indicating whether or not the IConnection instance is closed.
true
if and only if the IConnection is closed, otherwise false
.Implemented in NATS.Client.Connection.
bool NATS.Client.IConnection.IsDraining | ( | ) |
Returns a value indicating whether or not the IConnection connection is draining.
true
if and only if the IConnection is closed, otherwise false
.Implemented in NATS.Client.Connection.
bool NATS.Client.IConnection.IsReconnecting | ( | ) |
Returns a value indicating whether or not the IConnection is currently reconnecting.
true
if and only if the IConnection is reconnecting, otherwise false
.Implemented in NATS.Client.Connection.
string NATS.Client.IConnection.NewInbox | ( | ) |
Creates an inbox string which can be used for directed replies from subscribers.
The returned inboxes are guaranteed to be unique, but can be shared and subscribed to by others.
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Publish | ( | Msg | msg | ) |
Publishes a Msg instance, which includes the subject, an optional reply, and an optional data field.
msg | A Msg instance containing the subject, optional reply, and data to publish to the NATS server. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Publish | ( | string | subject, |
byte[] | data | ||
) |
Publishes data to the given subject .
NATS implements a publish-subscribe message distribution model. NATS publish subscribe is a one-to-many communication. A publisher sends a message on a subject. Any active subscriber listening on that subject receives the message. Subscribers can register interest in wildcard subjects.
In the basic NATS platform, if a subscriber is not listening on the subject (no subject match), or is not active when the message is sent, the message is not received. NATS is a fire-and-forget messaging system. If you need higher levels of service, you can either use NATS Streaming, or build the additional reliability into your client(s) yourself.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
NATSReconnectBufferException | is thrown when publishing while reconnecting and the internal reconnect buffer has been disabled or exceeded. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Publish | ( | string | subject, |
byte[] | data, | ||
int | offset, | ||
int | count | ||
) |
Publishes a sequence of bytes from data to the given subject .
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Publish | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data | ||
) |
Publishes data to the given subject .
NATS implements a publish-subscribe message distribution model. NATS publish subscribe is a one-to-many communication. A publisher sends a message on a subject. Any active subscriber listening on that subject receives the message. Subscribers can register interest in wildcard subjects.
In the basic NATS platform, if a subscriber is not listening on the subject (no subject match), or is not active when the message is sent, the message is not received. NATS is a fire-and-forget messaging system. If you need higher levels of service, you can either use NATS Streaming, or build the additional reliability into your client(s) yourself.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
NATSReconnectBufferException | is thrown when publishing while reconnecting and the internal reconnect buffer has been disabled or exceeded. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Publish | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data, | ||
int | offset, | ||
int | count | ||
) |
Publishes a sequence of bytes from data to the given subject .
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Publish | ( | string | subject, |
string | reply, | ||
byte[] | data | ||
) |
Publishes data to the given subject .
subject | The subject to publish data to over the current connection. |
reply | An optional reply subject. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Publish | ( | string | subject, |
string | reply, | ||
byte[] | data, | ||
int | offset, | ||
int | count | ||
) |
Publishes a sequence of bytes from data to the given subject .
subject | The subject to publish data to over the current connection. |
reply | An optional reply subject. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Publish | ( | string | subject, |
string | reply, | ||
MsgHeader | headers, | ||
byte[] | data | ||
) |
Publishes data to the given subject .
subject | The subject to publish data to over the current connection. |
reply | An optional reply subject. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.Publish | ( | string | subject, |
string | reply, | ||
MsgHeader | headers, | ||
byte[] | data, | ||
int | offset, | ||
int | count | ||
) |
Publishes a sequence of bytes from data to the given subject .
subject | The subject to publish data to over the current connection. |
reply | An optional reply subject. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
Implemented in NATS.Client.Connection.
Sends a request message and returns the response Msg.
NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.
Request(Msg) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
=
message | A Msg that contains the request data to publish to the connected NATS server. Any reply subject will be overridden. |
Implemented in NATS.Client.Connection.
Sends a request message and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
Request(Msg, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
message | A NATS Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Msg NATS.Client.IConnection.Request | ( | string | subject, |
byte[] | data | ||
) |
Sends a request payload and returns the response Msg.
NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.
Request(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
Msg NATS.Client.IConnection.Request | ( | string | subject, |
byte[] | data, | ||
int | offset, | ||
int | count | ||
) |
Sends a sequence of bytes as the request payload and returns the response Msg.
NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.
Request(string, byte[], int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
Implemented in NATS.Client.Connection.
Msg NATS.Client.IConnection.Request | ( | string | subject, |
byte[] | data, | ||
int | offset, | ||
int | count, | ||
int | timeout | ||
) |
Sends a sequence of bytes as the request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
Request(string, byte[], int, int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Msg NATS.Client.IConnection.Request | ( | string | subject, |
byte[] | data, | ||
int | timeout | ||
) |
Sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
Request(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Sends a request payload and returns the response Msg.
NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.
Request(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
Msg NATS.Client.IConnection.Request | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data, | ||
int | offset, | ||
int | count | ||
) |
Sends a sequence of bytes as the request payload and returns the response Msg.
NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.
Request(string, byte[], int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
Implemented in NATS.Client.Connection.
Msg NATS.Client.IConnection.Request | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data, | ||
int | offset, | ||
int | count, | ||
int | timeout | ||
) |
Sends a sequence of bytes as the request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
Request(string, byte[], int, int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
Request(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Asynchronously sends a request message and returns the response Msg.
RequestAsync(Msg) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
message | A NATS Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden. |
Implemented in NATS.Client.Connection.
Asynchronously sends a request message and returns the response Msg, while monitoring for cancellation requests.
RequestAsync(Msg, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
message | A NATS Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
Asynchronously sends a request message and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
RequestAsync(Msg, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
message | A NATS message Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | Msg | message, |
int | timeout, | ||
CancellationToken | token | ||
) |
Asynchronously sends a request message and returns the response Msg, or throws NATSTimeoutException if the timeout expires, while monitoring for cancellation requests.
RequestAsync(Msg, int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
message | A NATS Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden. |
timeout | The number of milliseconds to wait. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
byte[] | data | ||
) |
Asynchronously sends a request payload and returns the response Msg.
RequestAsync(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
byte[] | data, | ||
CancellationToken | token | ||
) |
Asynchronously sends a request payload and returns the response Msg, while monitoring for cancellation requests.
RequestAsync(string, byte[], CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
byte[] | data, | ||
int | offset, | ||
int | count | ||
) |
Asynchronously sends a sequence of bytes as the request payload and returns the response Msg.
RequestAsync(string, byte[], int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
byte[] | data, | ||
int | offset, | ||
int | count, | ||
CancellationToken | token | ||
) |
Asynchronously sends a sequence of bytes as the request payload and returns the response Msg, while monitoring for cancellation requests.
RequestAsync(string, byte[], int, int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
byte[] | data, | ||
int | offset, | ||
int | count, | ||
int | timeout | ||
) |
Asynchronously sends a sequence of bytes as the request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
RequestAsync(string, byte[], int, int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
byte[] | data, | ||
int | timeout | ||
) |
Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
RequestAsync(string, byte[], int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
byte[] | data, | ||
int | timeout, | ||
CancellationToken | token | ||
) |
Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires, while monitoring for cancellation requests.
RequestAsync(string, byte[], int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
Asynchronously sends a request payload and returns the response Msg.
RequestAsync(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data, | ||
CancellationToken | token | ||
) |
Asynchronously sends a request payload and returns the response Msg, while monitoring for cancellation requests.
RequestAsync(string, byte[], CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data, | ||
int | offset, | ||
int | count | ||
) |
Asynchronously sends a sequence of bytes as the request payload and returns the response Msg.
RequestAsync(string, byte[], int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data, | ||
int | offset, | ||
int | count, | ||
CancellationToken | token | ||
) |
Asynchronously sends a sequence of bytes as the request payload and returns the response Msg, while monitoring for cancellation requests.
RequestAsync(string, byte[], int, int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data, | ||
int | offset, | ||
int | count, | ||
int | timeout | ||
) |
Asynchronously sends a sequence of bytes as the request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
RequestAsync(string, byte[], int, int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
offset | The zero-based byte offset in data at which to begin publishing bytes to the subject. |
count | The number of bytes to be published to the subject. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data, | ||
int | timeout | ||
) |
Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
RequestAsync(string, byte[], int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Task< Msg > NATS.Client.IConnection.RequestAsync | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data, | ||
int | timeout, | ||
CancellationToken | token | ||
) |
Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires, while monitoring for cancellation requests.
RequestAsync(string, byte[], int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | The subject to publish data to over the current connection. |
headers | Optional headers to publish with the message. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
void NATS.Client.IConnection.ResetStats | ( | ) |
Resets the associated statistics for the IConnection.
Implemented in NATS.Client.Connection.
TimeSpan NATS.Client.IConnection.RTT | ( | ) |
Calculates the round trip time between this client and the server.
Implemented in NATS.Client.Connection.
IAsyncSubscription NATS.Client.IConnection.SubscribeAsync | ( | string | subject | ) |
Expresses interest in the given subject to the NATS Server.
The IAsyncSubscription returned will not start receiving messages until IAsyncSubscription.Start is called.
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
Implemented in NATS.Client.Connection.
IAsyncSubscription NATS.Client.IConnection.SubscribeAsync | ( | string | subject, |
EventHandler< MsgHandlerEventArgs > | handler | ||
) |
Expresses interest in the given subject to the NATS Server, and begins delivering messages to the given event handler.
The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
handler | The EventHandler<TEventArgs> invoked when messages are received on the returned IAsyncSubscription. |
Implemented in NATS.Client.Connection.
IAsyncSubscription NATS.Client.IConnection.SubscribeAsync | ( | string | subject, |
string | queue | ||
) |
Creates an asynchronous queue subscriber on the given subject .
All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message.
The IAsyncSubscription returned will not start receiving messages until IAsyncSubscription.Start is called.
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
queue | The name of the queue group in which to participate. |
Implemented in NATS.Client.Connection.
IAsyncSubscription NATS.Client.IConnection.SubscribeAsync | ( | string | subject, |
string | queue, | ||
EventHandler< MsgHandlerEventArgs > | handler | ||
) |
Creates an asynchronous queue subscriber on the given subject , and begins delivering messages to the given event handler.
All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message.
The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
queue | The name of the queue group in which to participate. |
handler | The EventHandler<MsgHandlerEventArgs> invoked when messages are received on the returned IAsyncSubscription. |
Implemented in NATS.Client.Connection.
ISyncSubscription NATS.Client.IConnection.SubscribeSync | ( | string | subject | ) |
Expresses interest in the given subject to the NATS Server.
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
Implemented in NATS.Client.Connection.
ISyncSubscription NATS.Client.IConnection.SubscribeSync | ( | string | subject, |
string | queue | ||
) |
Creates a synchronous queue subscriber on the given subject .
All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message synchronously.
subject | The subject on which to listen for messages. |
queue | The name of the queue group in which to participate. |
Implemented in NATS.Client.Connection.
|
get |
Gets the ID of client as known by the NATS server, otherwise null
.
May not be supported in all versions of the server. If the client is connected to an older server or is in the process of connecting, 0 will be returned.
Implemented in NATS.Client.Connection.
|
get |
Gets the IP of client as known by the NATS server, otherwise null
.
Supported in the NATS server version 2.1.6 and above. If the client is connected to an older server or is in the process of connecting, null will be returned.
Implemented in NATS.Client.Connection.
|
get |
Gets an array of server URLs that were discovered after this instance connected.
If authentication is enabled, Options.User or Options.Token must be used when connecting with these URLs.
Implemented in NATS.Client.Connection.
|
get |
Gets the maximum size in bytes of any payload sent to the connected NATS Server.
Implemented in NATS.Client.Connection.
|
get |
Gets an array of known server URLs for this instance.
Servers also includes any additional servers discovered after a connection has been established. If authentication is enabled, Options.User or Options.Token must be used when connecting with these URLs.
Implemented in NATS.Client.Connection.
|
get |
|
get |
Gets the statistics tracked for the IConnection.
Implemented in NATS.Client.Connection.