Table of Contents

Method FetchAsync

Namespace
NATS.Client.JetStream
Assembly
NATS.Client.JetStream.dll

FetchAsync<T>(NatsJSFetchOpts, INatsDeserialize<T>?, CancellationToken)

Fetch messages from the stream in order.

public IAsyncEnumerable<NatsJSMsg<T>> FetchAsync<T>(NatsJSFetchOpts opts, INatsDeserialize<T>? serializer = null, CancellationToken cancellationToken = default)

Parameters

opts NatsJSFetchOpts

Fetch options.

serializer INatsDeserialize<T>

Serializer to use for the message type.

cancellationToken CancellationToken

A CancellationToken used to cancel fetch operation.

Returns

IAsyncEnumerable<NatsJSMsg<T>>

Asynchronous enumeration which can be used in a await foreach loop.

Type Parameters

T

Serialized message data type.