Table of Contents

Method CreateOrderedPushConsumerAsync

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

CreateOrderedPushConsumerAsync(string, NatsJSOrderedConsumerOpts?, CancellationToken)

Creates a new ordered push consumer that ensures messages are delivered in the exact order they were published to the stream, recreating the underlying ephemeral consumer if it skips or mismatches sequences.

public ValueTask<INatsJSPushConsumer> CreateOrderedPushConsumerAsync(string stream, NatsJSOrderedConsumerOpts? opts = null, CancellationToken cancellationToken = default)

Parameters

stream string

Name of the stream to create the consumer under.

opts NatsJSOrderedConsumerOpts

Ordered consumer options.

cancellationToken CancellationToken

A CancellationToken used to cancel the API call.

Returns

ValueTask<INatsJSPushConsumer>

The NATS JetStream push consumer object which can be used to retrieve ordered data from the stream with ConsumeAsync<T>(INatsDeserialize<T>?, NatsJSConsumeOpts?, CancellationToken).

Exceptions

ArgumentException

The stream name is invalid.

ArgumentNullException

The stream name is null.