NATS Streaming .NET Client  0.1.5
The nats.io .NET Streaming C# Client
STAN.Client.IStanConnection Interface Reference

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]
 

Detailed Description

A connection represents a connection to the NATS Streaming subsystem. It can publish and subscribe to messages within the NATS Streaming cluster.

Member Function Documentation

◆ Close()

void STAN.Client.IStanConnection.Close ( )

Closes the connection to to the NATS streaming server. If a NATS connection was provided, it will remain open.

Exceptions
StanCloseRequestExceptionError closing the connection.

◆ Publish() [1/2]

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.

Parameters
subjectSubject to publish the message to.
dataMessage payload.
Exceptions
StanExceptionWhen an error occurs locally or on the NATS streaming server.

◆ Publish() [2/2]

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.

Parameters
subjectSubject to publish the message to.
dataMessage payload.
handlerEvent handler to process message acknowledgements.
Returns
The GUID of the published message.
Exceptions
StanExceptionThrown when an error occurs publishing the message.

◆ PublishAsync()

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.

Parameters
subjectSubject to publish the message to.
data
Returns
The task object representing the asynchronous operation, containing the guid.

◆ Subscribe() [1/4]

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.

Parameters
subjectSubject of interest.
handlerA message handler to process messages.
Returns
A new Subscription
Exceptions
StanExceptionAn error occured creating the subscriber.

◆ Subscribe() [2/4]

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.

Parameters
subjectSubject of interest.
optionsSubscriptionOptions used to create the subscriber.
handlerA message handler to process messages.
Returns
A new subscription.
Exceptions
StanExceptionAn error occured creating the subscriber.

◆ Subscribe() [3/4]

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.

Parameters
subjectSubject of interest.
qgroupName of the queue group.
handlerA message handler to process messages.
Returns
A new subscription.

◆ Subscribe() [4/4]

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.

Parameters
subjectSubject of interest.
qgroupName of the queue group.
optionsSubscriptionOptions used to create the subscriber.
handlerA message handler to process messages.
Returns
A new subscription.

Property Documentation

◆ NATSConnection

NATS.Client.IConnection STAN.Client.IStanConnection.NATSConnection
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.


The documentation for this interface was generated from the following file: