Method CreateOrUpdatePushConsumerAsync
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
streamstringName of the stream to create or update the consumer under.
optsNatsJSPushConsumerOptsPush 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 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
streamname is invalid.- ArgumentNullException
The
streamname isnull.