Method CreateOrUpdateConsumerAsync
CreateOrUpdateConsumerAsync(string, ConsumerConfig, CancellationToken)
Creates new consumer if it doesn't exists or updates an existing one with the same name.
public ValueTask<INatsJSConsumer> CreateOrUpdateConsumerAsync(string stream, ConsumerConfig config, CancellationToken cancellationToken = default)
Parameters
streamstringName of the stream to create or update consumer under.
configConsumerConfigConsumer configuration.
cancellationTokenCancellationTokenA CancellationToken used to cancel the API call.
Returns
- ValueTask<INatsJSConsumer>
The NATS JetStream consumer object which can be used retrieving data from the stream.
Exceptions
- NatsJSException
Ack policy is set to
noneor there was an issue retrieving the response.- NatsJSApiException
Server responded with an error.
- ArgumentException
The
streamname is invalid.- ArgumentNullException
The
streamname isnull.