NATS .NET Client
1.1.4
The NATS.io .NET C# Client
|
Public Member Functions | |
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) |
Properties | |
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] |
Represents interest in a NATS topic.
Subscriptions represent interest in a topic on a NATS Server or cluster of NATS Servers. Subscriptions can be exact or include wildcards. A subscriber can process a NATS message synchronously (ISyncSubscription) or asynchronously (IAsyncSubscription).
void NATS.Client.ISubscription.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.
max | The maximum number of messages to receive on the subscription before calling Unsubscribe. Values less than or equal to zero (0 ) unsubscribe immediately. |
Implemented in NATS.Client.AsyncSubscription, and NATS.Client.Subscription.
void NATS.Client.ISubscription.Drain | ( | ) |
Drains a subscription for gracefully unsubscribing.
This method unsubscribes the subscriber and drains all remaining messages.
Implemented in NATS.Client.Subscription.
void NATS.Client.ISubscription.Drain | ( | int | timeout | ) |
Drains a subscription for gracefully unsubscribing.
timeout | The duration in milliseconds to wait while draining. |
///
Implemented in NATS.Client.Subscription.
Task NATS.Client.ISubscription.DrainAsync | ( | ) |
Drains a subscription for gracefully unsubscribing.
This method unsubscribes the subscriber and drains all remaining messages.
Implemented in NATS.Client.Subscription.
Task NATS.Client.ISubscription.DrainAsync | ( | int | timeout | ) |
Drains a subscription for gracefully unsubscribing.
timeout | The duration in milliseconds to wait while draining. |
///
Implemented in NATS.Client.Subscription.
void NATS.Client.ISubscription.GetMaxPending | ( | out long | maxPendingBytes, |
out long | maxPendingMessages | ||
) |
Returns the maximum number of pending bytes and messages during the life of the Subscription.
maxPendingBytes | When this method returns, maxPendingBytes will contain the current maximum pending bytes. |
maxPendingMessages | When this method returns, maxPendingBytes will contain the current maximum pending messages. |
Implemented in NATS.Client.Subscription.
void NATS.Client.ISubscription.GetPending | ( | out long | pendingBytes, |
out long | pendingMessages | ||
) |
Returns the pending byte and message counts.
pendingBytes | When this method returns, pendingBytes will contain the count of bytes not yet processed on the ISubscription. |
pendingMessages | When this method returns, pendingMessages will contain the count of messages not yet processed on the ISubscription. |
Implemented in NATS.Client.Subscription.
void NATS.Client.ISubscription.SetPendingLimits | ( | long | messageLimit, |
long | bytesLimit | ||
) |
Sets the limits for pending messages and bytes for this instance.
Zero (0
) is not allowed. Negative values indicate that the given metric is not limited.
messageLimit | The maximum number of pending messages. |
bytesLimit | The maximum number of pending bytes of payload. |
Implemented in NATS.Client.Subscription.
|
get |
Gets the number of known dropped messages for this instance.
This will correspond to the messages dropped by violations of PendingByteLimit and/or PendingMessageLimit. If the NATS server declares the connection a slow consumer, the count may not be accurate.
Implemented in NATS.Client.Subscription.
|
getset |
Gets or sets the maximum allowed count of pending bytes.
The limit must not be zero (0
). Negative values indicate there is no limit on the number of pending bytes.
Implemented in NATS.Client.Subscription.
|
getset |
Gets or sets the maximum allowed count of pending messages.
The limit must not be zero (0
). Negative values indicate there is no limit on the number of pending messages.
Implemented in NATS.Client.Subscription.
|
get |
Gets the optional queue group name.
If present, all subscriptions with the same name will form a distributed queue, and each message will only be processed by one member of the group. Although queue groups have multiple subscribers, each message is consumed by only one.
Implemented in NATS.Client.Subscription.
|
get |
Gets the subject for this subscription.
Subject names, including reply subject (INBOX) names, are case-sensitive and must be non-empty alphanumeric strings with no embedded whitespace, and optionally token-delimited using the dot character (.
), e.g.: FOO
, BAR
, foo.BAR
, FOO.BAR
, and FOO.BAR.BAZ
are all valid subject names, while: FOO. BAR
, foo. .bar
and foo..bar
are not valid subject names.
NATS supports the use of wildcards in subject subscriptions.
*
) matches any token at any level of the subject. >
), also known as the full wildcard, matches one or more tokens at the tail of a subject, and must be the last token. The wildcard subject foo.>
will match foo.bar
or foo.bar.baz.1
, but not foo
. foo.*.bar
or foo.>
are syntactically valid; foo*.bar
, f*o.b*r
and foo>
are not). For example, the wildcard subscriptions foo.*.quux
and foo.>
both match foo.bar.quux
, but only the latter matches foo.bar.baz
. With the full wildcard, it is also possible to express interest in every subject that may exist in NATS (>
).
Implemented in NATS.Client.Subscription.