Table of Contents

Method CreateOrUpdatePushConsumerAsync

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

CreateOrUpdatePushConsumerAsync(string, NatsJSPushConsumerOpts?, CancellationToken)

Creates a new push consumer if it doesn't exist or updates an existing one with the same name.

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

Parameters

stream string

Name of the stream to create or update the consumer under.

opts NatsJSPushConsumerOpts

Push 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 data from the stream with ConsumeAsync<T>(INatsDeserialize<T>?, NatsJSConsumeOpts?, CancellationToken).

Exceptions

NatsJSException

There was an issue retrieving the response, or DeliverSubject is not set.

NatsJSApiException

Server responded with an error.

ArgumentException

The stream name is invalid.

ArgumentNullException

The stream name is null.