NATS .NET Client
1.1.4
The NATS.io .NET C# Client
|
Classes | |
class | TCPConnection |
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, int timeout) |
Msg | Request (Msg message) |
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, int timeout) |
Task< Msg > | RequestAsync (Msg message) |
Task< Msg > | RequestAsync (Msg message, int timeout, CancellationToken token) |
Task< Msg > | RequestAsync (Msg message, 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 () |
void | Drain () |
void | Drain (int timeout) |
Task | DrainAsync () |
Task | DrainAsync (int timeout) |
bool | IsDraining () |
bool | IsReconnecting () |
void | ResetStats () |
override string | ToString () |
void | Dispose () |
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) |
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) |
Protected Member Functions | |
virtual void | Dispose (bool disposing) |
Properties | |
Options | Opts [get] |
string | ConnectedUrl [get] |
IPAddress | ClientIP [get] |
int | ClientID [get] |
string | ConnectedId [get] |
ServerInfo | ServerInfo [get] |
string[] | Servers [get] |
string[] | DiscoveredServers [get] |
Exception | LastError [get] |
ConnState | State [get] |
int | SubscriptionCount [get] |
IStatistics | Stats [get] |
long | MaxPayload [get] |
Properties inherited from NATS.Client.IConnection | |
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] |
Connection represents a bare connection to a NATS server. Users should create an IConnection instance using ConnectionFactory rather than directly using this class.
void NATS.Client.Connection.Close | ( | ) |
Closes the Connection and all associated subscriptions.
Implements NATS.Client.IConnection.
IJetStream NATS.Client.Connection.CreateJetStreamContext | ( | JetStreamOptions | options = null | ) |
Gets a context for publishing and subscribing to subjects backed by Jetstream streams and consumers.
options | Optional JetStream options. |
Implements NATS.Client.IConnection.
IJetStreamManagement NATS.Client.Connection.CreateJetStreamManagementContext | ( | JetStreamOptions | options = null | ) |
Gets a context for administrating JetStream.
options | Optional JetStream options. |
Implements NATS.Client.IConnection.
IKeyValue NATS.Client.Connection.CreateKeyValueContext | ( | string | bucketName, |
KeyValueOptions | options = null |
||
) |
Gets a context for a Key Value bucket
bucketName | The name of the bucket |
options | Optional KeyValueOptions. |
Implements NATS.Client.IConnection.
IKeyValueManagement NATS.Client.Connection.CreateKeyValueManagementContext | ( | KeyValueOptions | options = null | ) |
Gets a context for administrating Key Value buckets
options | Optional KeyValueOptions. |
Implements NATS.Client.IConnection.
IObjectStore NATS.Client.Connection.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. |
Implements NATS.Client.IConnection.
IObjectStoreManagement NATS.Client.Connection.CreateObjectStoreManagementContext | ( | ObjectStoreOptions | options = null | ) |
Gets a context for administrating Object Stores OBJECT STORE IMPLEMENTATION IS EXPERIMENTAL AND SUBJECT TO CHANGE.
options | Optional ObjectStoreOptions. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.Dispose | ( | ) |
Releases all resources used by the Connection.
This method disposes the connection, by clearing all pending operations, and closing the connection to release resources.
|
protectedvirtual |
Closes the connection and optionally releases the managed resources.
In derived classes, do not override the Close method, instead put all of the
cleanup logic in your Dispose override.
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Reimplemented in NATS.Client.EncodedConnection.
void NATS.Client.Connection.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.
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
Implements NATS.Client.IConnection.
Task NATS.Client.Connection.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.
Implements NATS.Client.IConnection.
Task NATS.Client.Connection.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 before draining. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.Flush | ( | ) |
Performs a round trip to the server and returns when it receives the internal reply.
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
ArgumentOutOfRangeException | timeout is less than or equal to zero (0 ). |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
Implements NATS.Client.IConnection.
IConsumerContext NATS.Client.Connection.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 |
Implements NATS.Client.IConnection.
IConsumerContext NATS.Client.Connection.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. |
Implements NATS.Client.IConnection.
IStreamContext NATS.Client.Connection.GetStreamContext | ( | string | streamName | ) |
Get a stream context for a specific stream.
streamName | the stream for the context |
a StreamContext instance.
an IStreamContext instance
Implements NATS.Client.IConnection.
IStreamContext NATS.Client.Connection.GetStreamContext | ( | string | streamName, |
JetStreamOptions | options | ||
) |
Gets a stream context.
streamName | the stream for the context |
options | JetStream options. |
Implements NATS.Client.IConnection.
bool NATS.Client.Connection.IsClosed | ( | ) |
Returns a value indicating whether or not the Connection instance is closed.
true
if and only if the Connection is closed, otherwise false
.Implements NATS.Client.IConnection.
bool NATS.Client.Connection.IsDraining | ( | ) |
Returns a value indicating whether or not the Connection instance is draining.
true
if and only if the Connection is draining, otherwise false
.Implements NATS.Client.IConnection.
bool NATS.Client.Connection.IsReconnecting | ( | ) |
Returns a value indicating whether or not the Connection is currently reconnecting.
true
if and only if the Connection is reconnecting, otherwise false
.Implements NATS.Client.IConnection.
string NATS.Client.Connection.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.
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
ArgumentNullException | msg is null . |
NATSBadSubscriptionException | The Msg.Subject property of msg is null or entirely whitespace. |
NATSMaxPayloadException | Message data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | There was an unexpected exception performing an internal NATS call while publishing. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.Publish | ( | string | subject, |
byte[] | data | ||
) |
Publishes 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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | There was an unexpected exception performing an internal NATS call while publishing. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.Publish | ( | string | subject, |
MsgHeader | headers, | ||
byte[] | data | ||
) |
Publishes 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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | There was an unexpected exception performing an internal NATS call while publishing. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | There was an unexpected exception performing an internal NATS call while publishing. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | There was an unexpected exception performing an internal NATS call while publishing. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
Sends a request payload and returns the response Msg.
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 NATS Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden. |
ArgumentNullException | message is null. |
NATSBadSubscriptionException | The message subject is null or entirely whitespace. |
NATSMaxPayloadException | Message data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
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 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. |
ArgumentOutOfRangeException | timeout is less than or equal to zero (0 ). |
ArgumentNullException | message is null. |
NATSBadSubscriptionException | The message subject is null or entirely whitespace. |
NATSMaxPayloadException | Message data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Msg NATS.Client.Connection.Request | ( | string | subject, |
byte[] | data | ||
) |
Sends a request payload and returns the response Msg.
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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Msg NATS.Client.Connection.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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Msg NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
Msg NATS.Client.Connection.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. |
ArgumentOutOfRangeException | timeout is less than or equal to zero (0 ). |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Sends a request payload and returns the response Msg.
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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
Msg NATS.Client.Connection.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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Msg NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
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. |
ArgumentOutOfRangeException | timeout is less than or equal to zero (0 ). |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
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. |
ArgumentNullException | message is null. |
NATSBadSubscriptionException | The message subject is null or entirely whitespace. |
NATSMaxPayloadException | Message data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
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. |
token | The token to monitor for cancellation requests. |
ArgumentNullException | message is null. |
NATSBadSubscriptionException | The message subject is null or entirely whitespace. |
NATSMaxPayloadException | Message data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
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 Msg that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
ArgumentException | timeout is less than or equal to zero (0 ). |
ArgumentNullException | message is null. |
NATSBadSubscriptionException | The message subject is null or entirely whitespace. |
NATSMaxPayloadException | Message data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
timeout | The number of milliseconds to wait. |
token | The token to monitor for cancellation requests. |
ArgumentException | timeout is less than or equal to zero (0 ). |
ArgumentNullException | message is null. |
NATSBadSubscriptionException | The message subject is null or entirely whitespace. |
NATSMaxPayloadException | Message data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
ArgumentException | timeout is less than or equal to zero (0 ). |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
ArgumentException | timeout is less than or equal to zero (0 ). |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
ArgumentException | timeout is less than or equal to zero (0 ). |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
Task< Msg > NATS.Client.Connection.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. |
ArgumentException | timeout is less than or equal to zero (0 ). |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | data exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSNoRespondersException | No responders are available for this request. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details. |
OperationCanceledException | The asynchronous operation was cancelled or timed out before it could be completed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
void NATS.Client.Connection.ResetStats | ( | ) |
Resets the associated statistics for the Connection.
Implements NATS.Client.IConnection.
TimeSpan NATS.Client.Connection.RTT | ( | ) |
NATSConnectionClosedException | If the connection is closed. |
NATSException | Miscellaneous other exceptions |
Implements NATS.Client.IConnection.
IAsyncSubscription NATS.Client.Connection.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: > ). |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSConnectionClosedException | The Connection is closed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
IAsyncSubscription NATS.Client.Connection.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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSConnectionClosedException | The Connection is closed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
IAsyncSubscription NATS.Client.Connection.SubscribeAsync | ( | string | subject, |
string | queue | ||
) |
Creates an asynchronous queue subscriber on the given subject .
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. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSConnectionClosedException | The Connection is closed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
IAsyncSubscription NATS.Client.Connection.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.
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<TEventArgs> invoked when messages are received on the returned IAsyncSubscription. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSConnectionClosedException | The Connection is closed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
ISyncSubscription NATS.Client.Connection.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: > ). |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSConnectionClosedException | The Connection is closed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IConnection.
ISyncSubscription NATS.Client.Connection.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. |
Implements NATS.Client.IConnection.
override string NATS.Client.Connection.ToString | ( | ) |
Returns a string representation of the value of this Connection instance.
|
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.
Implements NATS.Client.IConnection.
|
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.
Implements NATS.Client.IConnection.
|
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.
Implements NATS.Client.IConnection.
|
get |
Gets the maximum size in bytes of a payload sent to the connected NATS Server.
Implements NATS.Client.IConnection.
|
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.
Implements NATS.Client.IConnection.
|
get |
|
get |
Gets the statistics tracked for the Connection.
Implements NATS.Client.IConnection.