Table of Contents

Method CreateStreamAsync

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

CreateStreamAsync(StreamConfig, CancellationToken)

Creates a new stream if it doesn't exist or returns an existing stream with the same name.

public ValueTask<INatsJSStream> CreateStreamAsync(StreamConfig config, CancellationToken cancellationToken = default)

Parameters

config StreamConfig

Stream configuration request to be sent to NATS JetStream server.

cancellationToken CancellationToken

A CancellationToken used to cancel the API call.

Returns

ValueTask<INatsJSStream>

The NATS JetStream stream object which can be used to manage the stream.

Exceptions

NatsJSException

There was an issue retrieving the response.

NatsJSApiException

Server responded with an error.

ArgumentException

The stream name in config is invalid.

ArgumentNullException

The name in config is null.