NATS .NET Client  1.1.4
The NATS.io .NET C# Client
NATS.Client.IConnection Interface Reference
Inheritance diagram for NATS.Client.IConnection:
NATS.Client.Connection NATS.Client.EncodedConnection

Public Member Functions

void Publish (string subject, byte[] data)
 
void Publish (string subject, MsgHeader headers, byte[] data)
 
void Publish (string subject, byte[] data, int offset, int count)
 
void Publish (string subject, MsgHeader headers, byte[] data, int offset, int count)
 
void Publish (string subject, string reply, byte[] data)
 
void Publish (string subject, string reply, MsgHeader headers, byte[] data)
 
void Publish (string subject, string reply, byte[] data, int offset, int count)
 
void Publish (string subject, string reply, MsgHeader headers, byte[] data, int offset, int count)
 
void Publish (Msg msg)
 
Msg Request (string subject, byte[] data, int timeout)
 
Msg Request (string subject, MsgHeader headers, byte[] data, int timeout)
 
Msg Request (string subject, byte[] data, int offset, int count, int timeout)
 
Msg Request (string subject, MsgHeader headers, byte[] data, int offset, int count, int timeout)
 
Msg Request (string subject, byte[] data)
 
Msg Request (string subject, MsgHeader headers, byte[] data)
 
Msg Request (string subject, byte[] data, int offset, int count)
 
Msg Request (string subject, MsgHeader headers, byte[] data, int offset, int count)
 
Msg Request (Msg message)
 
Msg Request (Msg message, int timeout)
 
Task< MsgRequestAsync (string subject, byte[] data, int timeout)
 
Task< MsgRequestAsync (string subject, MsgHeader headers, byte[] data, int timeout)
 
Task< MsgRequestAsync (string subject, byte[] data, int offset, int count, int timeout)
 
Task< MsgRequestAsync (string subject, MsgHeader headers, byte[] data, int offset, int count, int timeout)
 
Task< MsgRequestAsync (string subject, byte[] data)
 
Task< MsgRequestAsync (string subject, MsgHeader headers, byte[] data)
 
Task< MsgRequestAsync (string subject, byte[] data, int offset, int count)
 
Task< MsgRequestAsync (string subject, MsgHeader headers, byte[] data, int offset, int count)
 
Task< MsgRequestAsync (string subject, byte[] data, int timeout, CancellationToken token)
 
Task< MsgRequestAsync (string subject, MsgHeader headers, byte[] data, int timeout, CancellationToken token)
 
Task< MsgRequestAsync (string subject, byte[] data, CancellationToken token)
 
Task< MsgRequestAsync (string subject, MsgHeader headers, byte[] data, CancellationToken token)
 
Task< MsgRequestAsync (string subject, byte[] data, int offset, int count, CancellationToken token)
 
Task< MsgRequestAsync (string subject, MsgHeader headers, byte[] data, int offset, int count, CancellationToken token)
 
Task< MsgRequestAsync (Msg message)
 
Task< MsgRequestAsync (Msg message, int timeout)
 
Task< MsgRequestAsync (Msg message, CancellationToken token)
 
Task< MsgRequestAsync (Msg message, int timeout, CancellationToken token)
 
string NewInbox ()
 
ISyncSubscription SubscribeSync (string subject)
 
IAsyncSubscription SubscribeAsync (string subject)
 
IAsyncSubscription SubscribeAsync (string subject, EventHandler< MsgHandlerEventArgs > handler)
 
ISyncSubscription SubscribeSync (string subject, string queue)
 
IAsyncSubscription SubscribeAsync (string subject, string queue)
 
IAsyncSubscription SubscribeAsync (string subject, string queue, EventHandler< MsgHandlerEventArgs > handler)
 
void Flush (int timeout)
 
TimeSpan RTT ()
 
void Flush ()
 
void FlushBuffer ()
 
void Close ()
 
bool IsClosed ()
 
bool IsReconnecting ()
 
void ResetStats ()
 
Task DrainAsync ()
 
Task DrainAsync (int timeout)
 
void Drain ()
 
void Drain (int timeout)
 
bool IsDraining ()
 
IStreamContext GetStreamContext (string streamName)
 
IStreamContext GetStreamContext (string streamName, JetStreamOptions options)
 
IConsumerContext GetConsumerContext (string streamName, string consumerName)
 
IConsumerContext GetConsumerContext (string streamName, string consumerName, JetStreamOptions options)
 
IJetStream CreateJetStreamContext (JetStreamOptions options=null)
 
IJetStreamManagement CreateJetStreamManagementContext (JetStreamOptions options=null)
 
IKeyValue CreateKeyValueContext (string bucketName, KeyValueOptions options=null)
 
IKeyValueManagement CreateKeyValueManagementContext (KeyValueOptions options=null)
 
IObjectStore CreateObjectStoreContext (string bucketName, ObjectStoreOptions options=null)
 
IObjectStoreManagement CreateObjectStoreManagementContext (ObjectStoreOptions options=null)
 

Properties

Options Opts [get]
 
IPAddress ClientIP [get]
 
int ClientID [get]
 
string ConnectedUrl [get]
 
string ConnectedId [get]
 
ServerInfo ServerInfo [get]
 
string[] Servers [get]
 
string[] DiscoveredServers [get]
 
Exception LastError [get]
 
ConnState State [get]
 
IStatistics Stats [get]
 
long MaxPayload [get]
 
int SubscriptionCount [get]
 

Detailed Description

Represents a connection to the NATS server.

Member Function Documentation

◆ Close()

void NATS.Client.IConnection.Close ( )

Closes the IConnection and all associated subscriptions.

See also
IsClosed, State

Implemented in NATS.Client.Connection.

◆ CreateJetStreamContext()

IJetStream NATS.Client.IConnection.CreateJetStreamContext ( JetStreamOptions  options = null)

Gets a context for publishing and subscribing to subjects backed by Jetstream streams and consumers.

Parameters
optionsOptional JetStream options.
Returns

Implemented in NATS.Client.Connection.

◆ CreateJetStreamManagementContext()

IJetStreamManagement NATS.Client.IConnection.CreateJetStreamManagementContext ( JetStreamOptions  options = null)

Gets a context for administrating JetStream.

Parameters
optionsOptional JetStream options.
Returns
an IJetStreamManagement instance

Implemented in NATS.Client.Connection.

◆ CreateKeyValueContext()

IKeyValue NATS.Client.IConnection.CreateKeyValueContext ( string  bucketName,
KeyValueOptions  options = null 
)

Gets a context for a Key Value bucket

Parameters
bucketNameThe name of the bucket
optionsOptional KeyValueOptions.
Returns

Implemented in NATS.Client.Connection.

◆ CreateKeyValueManagementContext()

IKeyValueManagement NATS.Client.IConnection.CreateKeyValueManagementContext ( KeyValueOptions  options = null)

Gets a context for administrating Key Value buckets

Parameters
optionsOptional KeyValueOptions.
Returns

Implemented in NATS.Client.Connection.

◆ CreateObjectStoreContext()

IObjectStore NATS.Client.IConnection.CreateObjectStoreContext ( string  bucketName,
ObjectStoreOptions  options = null 
)

Gets a context for a Object Store OBJECT STORE IMPLEMENTATION IS EXPERIMENTAL AND SUBJECT TO CHANGE.

Parameters
bucketNameThe name of the bucket
optionsOptional ObjectStoreOptions.
Returns

Implemented in NATS.Client.Connection.

◆ CreateObjectStoreManagementContext()

IObjectStoreManagement NATS.Client.IConnection.CreateObjectStoreManagementContext ( ObjectStoreOptions  options = null)

Gets a context for administrating Object Stores OBJECT STORE IMPLEMENTATION IS EXPERIMENTAL AND SUBJECT TO CHANGE.

Parameters
optionsOptional ObjectStoreOptions.
Returns

Implemented in NATS.Client.Connection.

◆ Drain() [1/2]

void NATS.Client.IConnection.Drain ( )

Drains a connection for graceful shutdown.

Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages. Upon draining of the publishers, the connection will be closed. Use the Options.ClosedEventHandler option to know when the connection has moved from draining to closed.

See also
Close()

Implemented in NATS.Client.Connection.

◆ Drain() [2/2]

void NATS.Client.IConnection.Drain ( int  timeout)

Drains a connection for graceful shutdown.

Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages. Upon draining of the publishers, the connection will be closed. Use the Options.ClosedEventHandler option to know when the connection has moved from draining to closed.

See also
Close()
Parameters
timeoutThe duration to wait before draining.


Implemented in NATS.Client.Connection.

◆ DrainAsync() [1/2]

Task NATS.Client.IConnection.DrainAsync ( )

Drains a connection for graceful shutdown.

Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages. Upon draining of the publishers, the connection will be closed. Use the Options.ClosedEventHandler option to know when the connection has moved from draining to closed.

See also
Close()
Returns
A task that represents the asynchronous drain operation.

Implemented in NATS.Client.Connection.

◆ DrainAsync() [2/2]

Task NATS.Client.IConnection.DrainAsync ( int  timeout)

Drains a connection for graceful shutdown.

Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages. Upon draining of the publishers, the connection will be closed. Use the Options.ClosedEventHandler option to know when the connection has moved from draining to closed.

See also
Close()
Parameters
timeoutThe duration to wait for the drain to complete.
Returns
A task that represents the asynchronous drain operation.

Implemented in NATS.Client.Connection.

◆ Flush()

void NATS.Client.IConnection.Flush ( int  timeout)

Performs a round trip to the server and returns when it receives the internal reply, or throws a NATSTimeoutException exception if the NATS Server does not reply in time.

Parameters
timeoutThe number of milliseconds to wait.

Implemented in NATS.Client.Connection.

◆ FlushBuffer()

void NATS.Client.IConnection.FlushBuffer ( )

Immediately flushes the underlying connection buffer if the connection is valid.

Exceptions
NATSConnectionClosedExceptionThe Connection is closed.
NATSExceptionThere was an unexpected exception performing an internal NATS call while executing the request. See Exception.InnerException for more details.

Implemented in NATS.Client.Connection.

◆ GetConsumerContext() [1/2]

IConsumerContext NATS.Client.IConnection.GetConsumerContext ( string  streamName,
string  consumerName 
)

Get a consumer context for a specific named stream and specific named consumer. Verifies that the stream and consumer exist.

Parameters
streamNamethe name of the stream
consumerNamethe name of the consumer
Returns
an IConsumerContext instance

Implemented in NATS.Client.Connection.

◆ GetConsumerContext() [2/2]

IConsumerContext NATS.Client.IConnection.GetConsumerContext ( string  streamName,
string  consumerName,
JetStreamOptions  options 
)

Get a consumer context for a specific named stream and specific named consumer. Verifies that the stream and consumer exist.

Parameters
streamNamethe name of the stream
consumerNamethe name of the consumer
optionsJetStream options.
Returns
an IConsumerContext instance

Implemented in NATS.Client.Connection.

◆ GetStreamContext() [1/2]

IStreamContext NATS.Client.IConnection.GetStreamContext ( string  streamName)

Get a stream context for a specific stream.

Parameters
streamNamethe stream for the context
Returns

a StreamContext instance.

an IStreamContext instance

Implemented in NATS.Client.Connection.

◆ GetStreamContext() [2/2]

IStreamContext NATS.Client.IConnection.GetStreamContext ( string  streamName,
JetStreamOptions  options 
)

Gets a stream context.

Parameters
streamNamethe stream for the context
optionsJetStream options.
Returns
an IStreamContext instance

Implemented in NATS.Client.Connection.

◆ IsClosed()

bool NATS.Client.IConnection.IsClosed ( )

Returns a value indicating whether or not the IConnection instance is closed.

Returns
true if and only if the IConnection is closed, otherwise false.
See also
Close, State

Implemented in NATS.Client.Connection.

◆ IsDraining()

bool NATS.Client.IConnection.IsDraining ( )

Returns a value indicating whether or not the IConnection connection is draining.

Returns
true if and only if the IConnection is closed, otherwise false.
See also
Close, State

Implemented in NATS.Client.Connection.

◆ IsReconnecting()

bool NATS.Client.IConnection.IsReconnecting ( )

Returns a value indicating whether or not the IConnection is currently reconnecting.

Returns
true if and only if the IConnection is reconnecting, otherwise false.
See also
State

Implemented in NATS.Client.Connection.

◆ NewInbox()

string NATS.Client.IConnection.NewInbox ( )

Creates an inbox string which can be used for directed replies from subscribers.

The returned inboxes are guaranteed to be unique, but can be shared and subscribed to by others.

Returns
A unique inbox string.

Implemented in NATS.Client.Connection.

◆ Publish() [1/9]

void NATS.Client.IConnection.Publish ( Msg  msg)

Publishes a Msg instance, which includes the subject, an optional reply, and an optional data field.

Parameters
msgA Msg instance containing the subject, optional reply, and data to publish to the NATS server.
See also
IConnection.Publish(string, byte[])

Implemented in NATS.Client.Connection.

◆ Publish() [2/9]

void NATS.Client.IConnection.Publish ( string  subject,
byte[]  data 
)

Publishes data to the given subject .

NATS implements a publish-subscribe message distribution model. NATS publish subscribe is a one-to-many communication. A publisher sends a message on a subject. Any active subscriber listening on that subject receives the message. Subscribers can register interest in wildcard subjects.

In the basic NATS platform, if a subscriber is not listening on the subject (no subject match), or is not active when the message is sent, the message is not received. NATS is a fire-and-forget messaging system. If you need higher levels of service, you can either use NATS Streaming, or build the additional reliability into your client(s) yourself.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the data to publish to the connected NATS server.
Exceptions
NATSReconnectBufferExceptionis thrown when publishing while reconnecting and the internal reconnect buffer has been disabled or exceeded.
See also
Options.ReconnectBufferSize

Implemented in NATS.Client.Connection.

◆ Publish() [3/9]

void NATS.Client.IConnection.Publish ( string  subject,
byte[]  data,
int  offset,
int  count 
)

Publishes a sequence of bytes from data to the given subject .

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
See also
IConnection.Publish(string, byte[])

Implemented in NATS.Client.Connection.

◆ Publish() [4/9]

void NATS.Client.IConnection.Publish ( string  subject,
MsgHeader  headers,
byte[]  data 
)

Publishes data to the given subject .

NATS implements a publish-subscribe message distribution model. NATS publish subscribe is a one-to-many communication. A publisher sends a message on a subject. Any active subscriber listening on that subject receives the message. Subscribers can register interest in wildcard subjects.

In the basic NATS platform, if a subscriber is not listening on the subject (no subject match), or is not active when the message is sent, the message is not received. NATS is a fire-and-forget messaging system. If you need higher levels of service, you can either use NATS Streaming, or build the additional reliability into your client(s) yourself.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the data to publish to the connected NATS server.
Exceptions
NATSReconnectBufferExceptionis thrown when publishing while reconnecting and the internal reconnect buffer has been disabled or exceeded.
See also
Options.ReconnectBufferSize

Implemented in NATS.Client.Connection.

◆ Publish() [5/9]

void NATS.Client.IConnection.Publish ( string  subject,
MsgHeader  headers,
byte[]  data,
int  offset,
int  count 
)

Publishes a sequence of bytes from data to the given subject .

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
See also
IConnection.Publish(string, byte[])

Implemented in NATS.Client.Connection.

◆ Publish() [6/9]

void NATS.Client.IConnection.Publish ( string  subject,
string  reply,
byte[]  data 
)

Publishes data to the given subject .

Parameters
subjectThe subject to publish data to over the current connection.
replyAn optional reply subject.
dataAn array of type Byte that contains the data to publish to the connected NATS server.
See also
IConnection.Publish(string, byte[])

Implemented in NATS.Client.Connection.

◆ Publish() [7/9]

void NATS.Client.IConnection.Publish ( string  subject,
string  reply,
byte[]  data,
int  offset,
int  count 
)

Publishes a sequence of bytes from data to the given subject .

Parameters
subjectThe subject to publish data to over the current connection.
replyAn optional reply subject.
dataAn array of type Byte that contains the data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
See also
IConnection.Publish(string, byte[])

Implemented in NATS.Client.Connection.

◆ Publish() [8/9]

void NATS.Client.IConnection.Publish ( string  subject,
string  reply,
MsgHeader  headers,
byte[]  data 
)

Publishes data to the given subject .

Parameters
subjectThe subject to publish data to over the current connection.
replyAn optional reply subject.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the data to publish to the connected NATS server.
See also
IConnection.Publish(string, byte[])

Implemented in NATS.Client.Connection.

◆ Publish() [9/9]

void NATS.Client.IConnection.Publish ( string  subject,
string  reply,
MsgHeader  headers,
byte[]  data,
int  offset,
int  count 
)

Publishes a sequence of bytes from data to the given subject .

Parameters
subjectThe subject to publish data to over the current connection.
replyAn optional reply subject.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
See also
IConnection.Publish(string, byte[])

Implemented in NATS.Client.Connection.

◆ Request() [1/10]

Msg NATS.Client.IConnection.Request ( Msg  message)

Sends a request message and returns the response Msg.

NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.

Request(Msg) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

=

Parameters
messageA Msg that contains the request data to publish to the connected NATS server. Any reply subject will be overridden.
Returns
A Msg with the response from the NATS server.

Implemented in NATS.Client.Connection.

◆ Request() [2/10]

Msg NATS.Client.IConnection.Request ( Msg  message,
int  timeout 
)

Sends a request message and returns the response Msg, or throws NATSTimeoutException if the timeout expires.

Request(Msg, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
messageA NATS Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden.
timeoutThe number of milliseconds to wait.
Returns
A Msg with the response from the NATS server.
See also
IConnection.Request(Msg)

Implemented in NATS.Client.Connection.

◆ Request() [3/10]

Msg NATS.Client.IConnection.Request ( string  subject,
byte[]  data 
)

Sends a request payload and returns the response Msg.

NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.

Request(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
Returns
A Msg with the response from the NATS server.

Implemented in NATS.Client.Connection.

◆ Request() [4/10]

Msg NATS.Client.IConnection.Request ( string  subject,
byte[]  data,
int  offset,
int  count 
)

Sends a sequence of bytes as the request payload and returns the response Msg.

NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.

Request(string, byte[], int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
Returns
A Msg with the response from the NATS server.

Implemented in NATS.Client.Connection.

◆ Request() [5/10]

Msg NATS.Client.IConnection.Request ( string  subject,
byte[]  data,
int  offset,
int  count,
int  timeout 
)

Sends a sequence of bytes as the request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.

Request(string, byte[], int, int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
timeoutThe number of milliseconds to wait.
Returns
A Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ Request() [6/10]

Msg NATS.Client.IConnection.Request ( string  subject,
byte[]  data,
int  timeout 
)

Sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.

Request(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
timeoutThe number of milliseconds to wait.
Returns
A Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ Request() [7/10]

Msg NATS.Client.IConnection.Request ( string  subject,
MsgHeader  headers,
byte[]  data 
)

Sends a request payload and returns the response Msg.

NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.

Request(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
Returns
A Msg with the response from the NATS server.

Implemented in NATS.Client.Connection.

◆ Request() [8/10]

Msg NATS.Client.IConnection.Request ( string  subject,
MsgHeader  headers,
byte[]  data,
int  offset,
int  count 
)

Sends a sequence of bytes as the request payload and returns the response Msg.

NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.

Request(string, byte[], int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
Returns
A Msg with the response from the NATS server.

Implemented in NATS.Client.Connection.

◆ Request() [9/10]

Msg NATS.Client.IConnection.Request ( string  subject,
MsgHeader  headers,
byte[]  data,
int  offset,
int  count,
int  timeout 
)

Sends a sequence of bytes as the request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.

Request(string, byte[], int, int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
timeoutThe number of milliseconds to wait.
Returns
A Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ Request() [10/10]

Msg NATS.Client.IConnection.Request ( string  subject,
MsgHeader  headers,
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.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
timeoutThe number of milliseconds to wait.
Returns
A Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [1/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( Msg  message)

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.

Parameters
messageA NATS Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(Msg)

Implemented in NATS.Client.Connection.

◆ RequestAsync() [2/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( Msg  message,
CancellationToken  token 
)

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.

Parameters
messageA NATS Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden.
tokenThe token to monitor for cancellation requests.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(Msg)

Implemented in NATS.Client.Connection.

◆ RequestAsync() [3/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( Msg  message,
int  timeout 
)

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.

Parameters
messageA NATS message Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden.
timeoutThe number of milliseconds to wait.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(Msg, int)

Implemented in NATS.Client.Connection.

◆ RequestAsync() [4/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( Msg  message,
int  timeout,
CancellationToken  token 
)

Asynchronously sends a request message and returns the response Msg, or throws NATSTimeoutException if the timeout expires, while monitoring for cancellation requests.

RequestAsync(Msg, int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
messageA NATS Msg that contains the request data to publish to the connected NATS server. The reply subject will be overridden.
timeoutThe number of milliseconds to wait.
tokenThe token to monitor for cancellation requests.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(Msg, int)

Implemented in NATS.Client.Connection.

◆ RequestAsync() [5/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
byte[]  data 
)

Asynchronously sends a request payload and returns the response Msg.

RequestAsync(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [6/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
byte[]  data,
CancellationToken  token 
)

Asynchronously sends a request payload and returns the response Msg, while monitoring for cancellation requests.

RequestAsync(string, byte[], CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
tokenThe token to monitor for cancellation requests.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [7/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
byte[]  data,
int  offset,
int  count 
)

Asynchronously sends a sequence of bytes as the request payload and returns the response Msg.

RequestAsync(string, byte[], int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [8/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
byte[]  data,
int  offset,
int  count,
CancellationToken  token 
)

Asynchronously sends a sequence of bytes as the request payload and returns the response Msg, while monitoring for cancellation requests.

RequestAsync(string, byte[], int, int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
tokenThe token to monitor for cancellation requests.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [9/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
byte[]  data,
int  offset,
int  count,
int  timeout 
)

Asynchronously sends a sequence of bytes as the request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.

RequestAsync(string, byte[], int, int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
timeoutThe number of milliseconds to wait.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [10/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
byte[]  data,
int  timeout 
)

Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.

RequestAsync(string, byte[], int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
timeoutThe number of milliseconds to wait.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [11/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
byte[]  data,
int  timeout,
CancellationToken  token 
)

Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires, while monitoring for cancellation requests.

RequestAsync(string, byte[], int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
timeoutThe number of milliseconds to wait.
tokenThe token to monitor for cancellation requests.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [12/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
MsgHeader  headers,
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.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [13/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
MsgHeader  headers,
byte[]  data,
CancellationToken  token 
)

Asynchronously sends a request payload and returns the response Msg, while monitoring for cancellation requests.

RequestAsync(string, byte[], CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
tokenThe token to monitor for cancellation requests.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [14/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
MsgHeader  headers,
byte[]  data,
int  offset,
int  count 
)

Asynchronously sends a sequence of bytes as the request payload and returns the response Msg.

RequestAsync(string, byte[], int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [15/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
MsgHeader  headers,
byte[]  data,
int  offset,
int  count,
CancellationToken  token 
)

Asynchronously sends a sequence of bytes as the request payload and returns the response Msg, while monitoring for cancellation requests.

RequestAsync(string, byte[], int, int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
tokenThe token to monitor for cancellation requests.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [16/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
MsgHeader  headers,
byte[]  data,
int  offset,
int  count,
int  timeout 
)

Asynchronously sends a sequence of bytes as the request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.

RequestAsync(string, byte[], int, int, int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
offsetThe zero-based byte offset in data at which to begin publishing bytes to the subject.
countThe number of bytes to be published to the subject.
timeoutThe number of milliseconds to wait.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [17/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
MsgHeader  headers,
byte[]  data,
int  timeout 
)

Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.

RequestAsync(string, byte[], int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
timeoutThe number of milliseconds to wait.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ RequestAsync() [18/18]

Task< Msg > NATS.Client.IConnection.RequestAsync ( string  subject,
MsgHeader  headers,
byte[]  data,
int  timeout,
CancellationToken  token 
)

Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires, while monitoring for cancellation requests.

RequestAsync(string, byte[], int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.

Parameters
subjectThe subject to publish data to over the current connection.
headersOptional headers to publish with the message.
dataAn array of type Byte that contains the request data to publish to the connected NATS server.
timeoutThe number of milliseconds to wait.
tokenThe token to monitor for cancellation requests.
Returns
A task that represents the asynchronous read operation. The value of the Task<TResult>.Result parameter contains a Msg with the response from the NATS server.
See also
IConnection.Request(string, byte[])

Implemented in NATS.Client.Connection.

◆ ResetStats()

void NATS.Client.IConnection.ResetStats ( )

Resets the associated statistics for the IConnection.

See also
Stats

Implemented in NATS.Client.Connection.

◆ RTT()

TimeSpan NATS.Client.IConnection.RTT ( )

Calculates the round trip time between this client and the server.

Returns
A timespan representing the elapsed time.

Implemented in NATS.Client.Connection.

◆ SubscribeAsync() [1/4]

IAsyncSubscription NATS.Client.IConnection.SubscribeAsync ( string  subject)

Expresses interest in the given subject to the NATS Server.

The IAsyncSubscription returned will not start receiving messages until IAsyncSubscription.Start is called.

Parameters
subjectThe subject on which to listen for messages. The subject can have wildcards (partial: *, full: >).
Returns
An IAsyncSubscription to use to read any messages received from the NATS Server on the given subject .
See also
ISubscription.Subject

Implemented in NATS.Client.Connection.

◆ SubscribeAsync() [2/4]

IAsyncSubscription NATS.Client.IConnection.SubscribeAsync ( string  subject,
EventHandler< MsgHandlerEventArgs handler 
)

Expresses interest in the given subject to the NATS Server, and begins delivering messages to the given event handler.

The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.

Parameters
subjectThe subject on which to listen for messages. The subject can have wildcards (partial: *, full: >).
handlerThe EventHandler<TEventArgs> invoked when messages are received on the returned IAsyncSubscription.
Returns
An IAsyncSubscription to use to read any messages received from the NATS Server on the given subject .
See also
ISubscription.Subject

Implemented in NATS.Client.Connection.

◆ SubscribeAsync() [3/4]

IAsyncSubscription NATS.Client.IConnection.SubscribeAsync ( string  subject,
string  queue 
)

Creates an asynchronous queue subscriber on the given subject .

All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message.

The IAsyncSubscription returned will not start receiving messages until IAsyncSubscription.Start is called.

Parameters
subjectThe subject on which to listen for messages. The subject can have wildcards (partial: *, full: >).
queueThe name of the queue group in which to participate.
Returns
An IAsyncSubscription to use to read any messages received from the NATS Server on the given subject .
See also
ISubscription.Subject, ISubscription.Queue

Implemented in NATS.Client.Connection.

◆ SubscribeAsync() [4/4]

IAsyncSubscription NATS.Client.IConnection.SubscribeAsync ( string  subject,
string  queue,
EventHandler< MsgHandlerEventArgs handler 
)

Creates an asynchronous queue subscriber on the given subject , and begins delivering messages to the given event handler.

All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message.

The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.

Parameters
subjectThe subject on which to listen for messages. The subject can have wildcards (partial: *, full: >).
queueThe name of the queue group in which to participate.
handlerThe EventHandler<MsgHandlerEventArgs> invoked when messages are received on the returned IAsyncSubscription.
Returns
An IAsyncSubscription to use to read any messages received from the NATS Server on the given subject .
See also
ISubscription.Subject, ISubscription.Queue

Implemented in NATS.Client.Connection.

◆ SubscribeSync() [1/2]

ISyncSubscription NATS.Client.IConnection.SubscribeSync ( string  subject)

Expresses interest in the given subject to the NATS Server.

Parameters
subjectThe subject on which to listen for messages. The subject can have wildcards (partial: *, full: >).
Returns
An ISyncSubscription to use to read any messages received from the NATS Server on the given subject .
See also
ISubscription.Subject

Implemented in NATS.Client.Connection.

◆ SubscribeSync() [2/2]

ISyncSubscription NATS.Client.IConnection.SubscribeSync ( string  subject,
string  queue 
)

Creates a synchronous queue subscriber on the given subject .

All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message synchronously.

Parameters
subjectThe subject on which to listen for messages.
queueThe name of the queue group in which to participate.
Returns
An ISyncSubscription to use to read any messages received from the NATS Server on the given subject , as part of the given queue group.
See also
ISubscription.Subject, ISubscription.Queue

Implemented in NATS.Client.Connection.

Property Documentation

◆ ClientID

int NATS.Client.IConnection.ClientID
get

Gets the ID of client as known by the NATS server, otherwise null.

May not be supported in all versions of the server. If the client is connected to an older server or is in the process of connecting, 0 will be returned.

Implemented in NATS.Client.Connection.

◆ ClientIP

IPAddress NATS.Client.IConnection.ClientIP
get

Gets the IP of client as known by the NATS server, otherwise null.

Supported in the NATS server version 2.1.6 and above. If the client is connected to an older server or is in the process of connecting, null will be returned.

Implemented in NATS.Client.Connection.

◆ DiscoveredServers

string [] NATS.Client.IConnection.DiscoveredServers
get

Gets an array of server URLs that were discovered after this instance connected.

If authentication is enabled, Options.User or Options.Token must be used when connecting with these URLs.

Implemented in NATS.Client.Connection.

◆ MaxPayload

◆ Servers

string [] NATS.Client.IConnection.Servers
get

Gets an array of known server URLs for this instance.

Servers also includes any additional servers discovered after a connection has been established. If authentication is enabled, Options.User or Options.Token must be used when connecting with these URLs.

Implemented in NATS.Client.Connection.

◆ State

ConnState NATS.Client.IConnection.State
get

Gets the current state of the IConnection.

See also
ConnState

Implemented in NATS.Client.Connection.

◆ Stats

IStatistics NATS.Client.IConnection.Stats
get

Gets the statistics tracked for the IConnection.

See also
ResetStats

Implemented in NATS.Client.Connection.


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