Table of Contents

Method GetPushConsumerAsync

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

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

stream string

Name of the stream the consumer is associated with.

consumer string

Consumer name.

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).

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 stream name is invalid.

ArgumentNullException

The stream name is null.