Method CreateOrderedPushConsumerAsync
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
streamstringName of the stream to create the consumer under.
optsNatsJSOrderedConsumerOptsOrdered consumer options.
cancellationTokenCancellationTokenA 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
streamname is invalid.- ArgumentNullException
The
streamname isnull.