Method GetPushConsumerAsync
GetPushConsumerAsync(string, string, CancellationToken)
Gets an existing push consumer from the server and creates a INatsJSPushConsumer handle for it.
public ValueTask<INatsJSPushConsumer> GetPushConsumerAsync(string stream, string consumer, CancellationToken cancellationToken = default)
Parameters
streamstringName of the stream the consumer is associated with.
consumerstringConsumer name.
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).
Remarks
This method returns a push consumer only if the existing consumer has a delivery subject configured.
Exceptions
- NatsJSException
There was an issue retrieving the response.
- NatsJSApiException
Server responded with an error.
- ArgumentException
The
streamname is invalid.- ArgumentNullException
The
streamname isnull.