Method WatchAsync
- Namespace
- NATS.Client.KeyValueStore
- Assembly
- NATS.Client.KeyValueStore.dll
WatchAsync<T>(string, INatsDeserialize<T>?, NatsKVWatchOpts?, CancellationToken)
Start a watcher for specific keys
IAsyncEnumerable<NatsKVEntry<T>> WatchAsync<T>(string key, INatsDeserialize<T>? serializer = null, NatsKVWatchOpts? opts = null, CancellationToken cancellationToken = default)
Parameters
key
stringKey to watch (subject-based wildcards may be used)
serializer
INatsDeserialize<T>Serializer to use for the message type.
opts
NatsKVWatchOptsWatch options
cancellationToken
CancellationTokenA CancellationToken used to cancel the API call.
Returns
- IAsyncEnumerable<NatsKVEntry<T>>
An asynchronous enumerable which can be used in
await foreach
loops
Type Parameters
T
Serialized value type
WatchAsync<T>(IEnumerable<string>, INatsDeserialize<T>?, NatsKVWatchOpts?, CancellationToken)
Start a watcher for specific keys
IAsyncEnumerable<NatsKVEntry<T>> WatchAsync<T>(IEnumerable<string> keys, INatsDeserialize<T>? serializer = null, NatsKVWatchOpts? opts = null, CancellationToken cancellationToken = default)
Parameters
keys
IEnumerable<string>Keys to watch (subject-based wildcards may be used)
serializer
INatsDeserialize<T>Serializer to use for the message type.
opts
NatsKVWatchOptsWatch options
cancellationToken
CancellationTokenA CancellationToken used to cancel the API call.
Returns
- IAsyncEnumerable<NatsKVEntry<T>>
An asynchronous enumerable which can be used in
await foreach
loops
Type Parameters
T
Serialized value type
Exceptions
- InvalidOperationException
There was a conflict in options, e.g. IncludeHistory and UpdatesOnly are only valid when ResumeAtRevision is not set.
WatchAsync<T>(INatsDeserialize<T>?, NatsKVWatchOpts?, CancellationToken)
Start a watcher for all the keys in the bucket
IAsyncEnumerable<NatsKVEntry<T>> WatchAsync<T>(INatsDeserialize<T>? serializer = null, NatsKVWatchOpts? opts = null, CancellationToken cancellationToken = default)
Parameters
serializer
INatsDeserialize<T>Serializer to use for the message type.
opts
NatsKVWatchOptsWatch options
cancellationToken
CancellationTokenA CancellationToken used to cancel the API call.
Returns
- IAsyncEnumerable<NatsKVEntry<T>>
An asynchronous enumerable which can be used in
await foreach
loops
Type Parameters
T
Serialized value type