NATS .NET Client  1.1.4
The NATS.io .NET C# Client
NATS.Client.AsyncSubscription Class Reference
Inheritance diagram for NATS.Client.AsyncSubscription:
NATS.Client.Subscription NATS.Client.IAsyncSubscription NATS.Client.ISubscription NATS.Client.ISubscription NATS.Client.ISubscription

Public Member Functions

void Start ()
 
override void Unsubscribe ()
 
override void AutoUnsubscribe (int max)
 
- Public Member Functions inherited from NATS.Client.Subscription
virtual void Unsubscribe ()
 
virtual void AutoUnsubscribe (int max)
 
void Dispose ()
 
override string ToString ()
 
void SetPendingLimits (long messageLimit, long bytesLimit)
 
void GetPending (out long pendingBytes, out long pendingMessages)
 
void GetMaxPending (out long maxPendingBytes, out long maxPendingMessages)
 
void ClearMaxPending ()
 
Task DrainAsync ()
 
Task DrainAsync (int timeout)
 
void Drain ()
 
void Drain (int timeout)
 
void Unsubscribe ()
 
void AutoUnsubscribe (int max)
 
void SetPendingLimits (long messageLimit, long bytesLimit)
 
void GetPending (out long pendingBytes, out long pendingMessages)
 
void GetMaxPending (out long maxPendingBytes, out long maxPendingMessages)
 
void ClearMaxPending ()
 
void Drain ()
 
void Drain (int timeout)
 
Task DrainAsync ()
 
Task DrainAsync (int timeout)
 
void Start ()
 

Events

EventHandler< MsgHandlerEventArgsMessageHandler
 
- Events inherited from NATS.Client.IAsyncSubscription
EventHandler< MsgHandlerEventArgsMessageHandler
 

Additional Inherited Members

- Static Public Member Functions inherited from NATS.Client.Subscription
static bool IsValidSubject (string subject)
 
static bool IsValidPrefix (string prefix)
 
static bool IsValidQueueGroupName (string queueGroup)
 
- Protected Member Functions inherited from NATS.Client.Subscription
long tallyDeliveredMessage (Msg msg)
 
virtual void Dispose (bool disposing)
 
- Properties inherited from NATS.Client.Subscription
long Sid [get]
 
string Subject [get]
 
string Queue [get]
 
Connection Connection [get]
 
bool IsValid [get]
 
int QueuedMessageCount [get]
 
long PendingByteLimit [get, set]
 
long PendingMessageLimit [get, set]
 
long PendingBytes [get]
 
long PendingMessages [get]
 
long MaxPendingBytes [get]
 
long MaxPendingMessages [get]
 
long Delivered [get]
 
long Dropped [get]
 
- Properties inherited from NATS.Client.ISubscription
long Sid [get]
 
string Subject [get]
 
string Queue [get]
 
Connection Connection [get]
 
bool IsValid [get]
 
int QueuedMessageCount [get]
 
long PendingByteLimit [get, set]
 
long PendingMessageLimit [get, set]
 
long PendingBytes [get]
 
long PendingMessages [get]
 
long MaxPendingBytes [get]
 
long MaxPendingMessages [get]
 
long Delivered [get]
 
long Dropped [get]
 

Detailed Description

AsyncSubscription asynchronously delivers messages to listeners of the MessageHandler event. This class should not be used directly.

If the AsyncSubscription is created without listening to the MessageHandler event, no messages will be received until Start() has been called.

Member Function Documentation

◆ AutoUnsubscribe()

override void NATS.Client.AsyncSubscription.AutoUnsubscribe ( int  max)

Issues an automatic call to Unsubscribe when max messages have been received.

This can be useful when sending a request to an unknown number of subscribers. Connection's Request methods use this functionality.

Calling this method will invoke Start if it has not already been called.

Parameters
maxThe maximum number of messages to receive on the subscription before calling Unsubscribe. Values less than or equal to zero (0) unsubscribe immediately.
Exceptions
NATSBadSubscriptionExceptionThere is no longer an associated Connection for this AsyncSubscription.

Implements NATS.Client.ISubscription.

◆ Start()

void NATS.Client.AsyncSubscription.Start ( )

Starts delivering received messages to listeners on MessageHandler from a separate thread.

If the IAsyncSubscription has already started delivering messages, this method is a no-op.

Exceptions
NATSBadSubscriptionExceptionThere is no longer an associated Connection for this AsyncSubscription.

Implements NATS.Client.IAsyncSubscription.

◆ Unsubscribe()

override void NATS.Client.AsyncSubscription.Unsubscribe ( )

Removes interest in the given subject.

Exceptions
NATSBadSubscriptionExceptionThere is no longer an associated Connection for this AsyncSubscription.

Implements NATS.Client.ISubscription.


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