Table of Contents

Property DrainOnCancel

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

DrainOnCancel

When true, cancelling the token passed to ConsumeAsync drains the consumer gracefully (stop pulling, deliver buffered messages so handlers can ACK, then complete) and leaves the connection usable, instead of stopping immediately. (default: false)

public bool DrainOnCancel { get; init; }

Property Value

bool

Remarks

Only the standard pull consumer's ConsumeAsync honors this. Ordered consumers (see NatsJSOrderedConsumer) do not ACK and always stop promptly on cancel, so the option has no effect there.