NATS .NET Client
1.1.4
The NATS.io .NET C# Client
|
Public Member Functions | |
void | Publish (string subject, Object obj) |
void | Publish (string subject, MsgHeader headers, Object obj) |
void | Publish (string subject, string reply, object obj) |
void | Publish (string subject, string reply, MsgHeader headers, object obj) |
IAsyncSubscription | SubscribeAsync (string subject, EventHandler< EncodedMessageEventArgs > handler) |
IAsyncSubscription | SubscribeAsync (string subject, string queue, EventHandler< EncodedMessageEventArgs > handler) |
object | Request (string subject, object obj, int timeout) |
object | Request (string subject, MsgHeader headers, object obj, int timeout) |
object | Request (string subject, object obj) |
object | Request (string subject, MsgHeader headers, object obj) |
Public Member Functions inherited from NATS.Client.Connection | |
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) |
Public Member Functions inherited from NATS.Client.IEncodedConnection | |
void | Publish (string subject, object obj) |
void | Publish (string subject, string reply, object obj) |
object | Request (string subject, object obj, int timeout) |
object | Request (string subject, object obj) |
string | NewInbox () |
IAsyncSubscription | SubscribeAsync (string subject, EventHandler< EncodedMessageEventArgs > handler) |
IAsyncSubscription | SubscribeAsync (string subject, string queue, EventHandler< EncodedMessageEventArgs > handler) |
void | Flush (int timeout) |
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 () |
Protected Member Functions | |
override void | Dispose (bool disposing) |
virtual void | Dispose (bool disposing) |
Properties | |
Serializer | OnSerialize [get, set] |
Deserializer | OnDeserialize [get, set] |
Properties inherited from NATS.Client.Connection | |
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] |
Properties inherited from NATS.Client.IEncodedConnection | |
Options | Opts [get] |
string | ConnectedUrl [get] |
string | ConnectedId [get] |
string[] | Servers [get] |
string[] | DiscoveredServers [get] |
Exception | LastError [get] |
ConnState | State [get] |
IStatistics | Stats [get] |
long | MaxPayload [get] |
Serializer | OnSerialize [get, set] |
Deserializer | OnDeserialize [get, set] |
int | SubscriptionCount [get] |
Represents an Connection which uses a client specified encoding scheme.
|
protectedvirtual |
Closes the EncodedConnection and optionally releases the managed resources.
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Reimplemented from NATS.Client.Connection.
void NATS.Client.EncodedConnection.Publish | ( | string | subject, |
MsgHeader | headers, | ||
Object | obj | ||
) |
Publishes the serialized value of obj to the given subject .
subject | The subject to publish obj to over the current connection. |
headers | Optional headers to publish with the message. |
obj | The Object to serialize and publish to the connected NATS server. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | obj exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | OnSerialize is null .-or-There was an unexpected exception performing an internal NATS call while publishing. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
void NATS.Client.EncodedConnection.Publish | ( | string | subject, |
Object | obj | ||
) |
Publishes the serialized value of obj to the given subject .
subject | The subject to publish obj to over the current connection. |
obj | The Object to serialize and publish to the connected NATS server. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | obj exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | OnSerialize is null .-or-There was an unexpected exception performing an internal NATS call while publishing. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
void NATS.Client.EncodedConnection.Publish | ( | string | subject, |
string | reply, | ||
MsgHeader | headers, | ||
object | obj | ||
) |
Publishes the serialized value of obj to the given subject .
subject | The subject to publish obj to over the current connection. |
reply | An optional reply subject. |
headers | Optional headers to publish with the message. |
obj | The Object to serialize and publish to the connected NATS server. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | obj exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | OnSerialize is null .-or-There was an unexpected exception performing an internal NATS call while publishing. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
void NATS.Client.EncodedConnection.Publish | ( | string | subject, |
string | reply, | ||
object | obj | ||
) |
Publishes the serialized value of obj to the given subject .
subject | The subject to publish obj to over the current connection. |
reply | An optional reply subject. |
obj | The Object to serialize and publish to the connected NATS server. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | obj exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | OnSerialize is null .-or-There was an unexpected exception performing an internal NATS call while publishing. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
object NATS.Client.EncodedConnection.Request | ( | string | subject, |
MsgHeader | headers, | ||
object | obj | ||
) |
Sends a request payload and returns the deserialized response.
Request(string, object) will create an unique inbox for this request, sharing a single subscription for all replies to this IEncodedConnection 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 obj to over the current connection. |
headers | Optional headers to publish with the message. |
obj | The Object to serialize and publish to the connected NATS server. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | obj 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. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
object NATS.Client.EncodedConnection.Request | ( | string | subject, |
MsgHeader | headers, | ||
object | obj, | ||
int | timeout | ||
) |
Sends a request payload and returns the deserialized response, or throws NATSTimeoutException if the timeout expires.
Request(string, object, int) will create an unique inbox for this request, sharing a single subscription for all replies to this IEncodedConnection 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 obj to over the current connection. |
headers | Optional headers to publish with the message. |
obj | The Object to serialize and 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 | obj 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. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
object NATS.Client.EncodedConnection.Request | ( | string | subject, |
object | obj | ||
) |
Sends a request payload and returns the deserialized response.
Request(string, object) will create an unique inbox for this request, sharing a single subscription for all replies to this IEncodedConnection 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 obj to over the current connection. |
obj | The Object to serialize and publish to the connected NATS server. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | obj 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. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
object NATS.Client.EncodedConnection.Request | ( | string | subject, |
object | obj, | ||
int | timeout | ||
) |
Sends a request payload and returns the deserialized response, or throws NATSTimeoutException if the timeout expires.
Request(string, object, int) will create an unique inbox for this request, sharing a single subscription for all replies to this IEncodedConnection 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 obj to over the current connection. |
obj | The Object to serialize and 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 | obj 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. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
IAsyncSubscription NATS.Client.EncodedConnection.SubscribeAsync | ( | string | subject, |
EventHandler< EncodedMessageEventArgs > | 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. |
ArgumentNullException | handler is null . |
NATSException | OnDeserialize is null . |
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.IEncodedConnection.
IAsyncSubscription NATS.Client.EncodedConnection.SubscribeAsync | ( | string | subject, |
string | queue, | ||
EventHandler< EncodedMessageEventArgs > | 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. |
ArgumentNullException | handler is null . |
NATSException | OnDeserialize is null . |
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.IEncodedConnection.
|
getset |
Gets or sets the method which is called to deserialize objects from a message payload.
If null
is given then the default deserialization method for the platform is used, if one exists.
Implements NATS.Client.IEncodedConnection.
|
getset |
Gets or sets the method which is called to serialize objects sent as a message payload.
If null
is given then the default serialization method for the platform is used, if one exists.
Implements NATS.Client.IEncodedConnection.