NATS Streaming .NET Client
0.1.5
The nats.io .NET Streaming C# Client
|
Inherits IDisposable.
Inherited by STAN.Client.Connection.
Public Member Functions | |
void | Publish (string subject, byte[] data) |
string | Publish (string subject, byte[] data, EventHandler< StanAckHandlerArgs > handler) |
Task< string > | PublishAsync (string subject, byte[] data) |
IStanSubscription | Subscribe (string subject, EventHandler< StanMsgHandlerArgs > handler) |
IStanSubscription | Subscribe (string subject, StanSubscriptionOptions options, EventHandler< StanMsgHandlerArgs > handler) |
IStanSubscription | Subscribe (string subject, string qgroup, EventHandler< StanMsgHandlerArgs > handler) |
IStanSubscription | Subscribe (string subject, string qgroup, StanSubscriptionOptions options, EventHandler< StanMsgHandlerArgs > handler) |
void | Close () |
Properties | |
NATS.Client.IConnection | NATSConnection [get] |
A connection represents a connection to the NATS Streaming subsystem. It can publish and subscribe to messages within the NATS Streaming cluster.
void STAN.Client.IStanConnection.Close | ( | ) |
Closes the connection to to the NATS streaming server. If a NATS connection was provided, it will remain open.
StanCloseRequestException | Error closing the connection. |
void STAN.Client.IStanConnection.Publish | ( | string | subject, |
byte [] | data | ||
) |
Publish publishes the data argument to the given subject. The data argument is left untouched and needs to be correctly interpreted on the receiver. This API is synchronous and waits for the acknowledgement or error from the NATS streaming server.
subject | Subject to publish the message to. |
data | Message payload. |
StanException | When an error occurs locally or on the NATS streaming server. |
string STAN.Client.IStanConnection.Publish | ( | string | subject, |
byte [] | data, | ||
EventHandler< StanAckHandlerArgs > | handler | ||
) |
Publish publishes the data argument to the given subject. The data argument is left untouched and needs to be correctly interpreted on the receiver. This API is asynchronous and handles the acknowledgement or error from the NATS streaming server in the provided handler. An exception is thrown when an error occurs during the send, the handler will process acknowledgments and errors.
subject | Subject to publish the message to. |
data | Message payload. |
handler | Event handler to process message acknowledgements. |
StanException | Thrown when an error occurs publishing the message. |
Task<string> STAN.Client.IStanConnection.PublishAsync | ( | string | subject, |
byte [] | data | ||
) |
Publish publishes the data argument to the given subject. The data argument is left untouched and needs to be correctly interpreted on the receiver. This API is asynchronous and handles the acknowledgement or error from the NATS streaming server in the provided handler. An exception is thrown when an error occurs during the send, the handler will process acknowledgments and errors.
subject | Subject to publish the message to. |
data |
IStanSubscription STAN.Client.IStanConnection.Subscribe | ( | string | subject, |
EventHandler< StanMsgHandlerArgs > | handler | ||
) |
Subscribe will create an Asynchronous Subscriber with interest in a given subject, assign the handler, and immediately start receiving messages. The subscriber will default options.
subject | Subject of interest. |
handler | A message handler to process messages. |
StanException | An error occured creating the subscriber. |
IStanSubscription STAN.Client.IStanConnection.Subscribe | ( | string | subject, |
StanSubscriptionOptions | options, | ||
EventHandler< StanMsgHandlerArgs > | handler | ||
) |
Subscribe will create an Asynchronous subscriber with interest in a given subject, assign the handler, and immediately start receiving messages.
subject | Subject of interest. |
options | SubscriptionOptions used to create the subscriber. |
handler | A message handler to process messages. |
StanException | An error occured creating the subscriber. |
IStanSubscription STAN.Client.IStanConnection.Subscribe | ( | string | subject, |
string | qgroup, | ||
EventHandler< StanMsgHandlerArgs > | handler | ||
) |
Subscribe will create an Asynchronous Subscriber with interest in a given subject, assign the handler, and immediately start receiving messages. The subscriber will use default subscriber options.
subject | Subject of interest. |
qgroup | Name of the queue group. |
handler | A message handler to process messages. |
IStanSubscription STAN.Client.IStanConnection.Subscribe | ( | string | subject, |
string | qgroup, | ||
StanSubscriptionOptions | options, | ||
EventHandler< StanMsgHandlerArgs > | handler | ||
) |
Subscribe will create an Asynchronous Subscriber with interest in a given subject, assign the handler, and immediately start receiving messages.
subject | Subject of interest. |
qgroup | Name of the queue group. |
options | SubscriptionOptions used to create the subscriber. |
handler | A message handler to process messages. |
|
get |
The NATConnection property gets the underlying NATS connection. Use this with care. For example, closing the underlying NATS conn will invalidate the NATS Streaming connection.