Table of Contents

Method PublishAsync

Namespace
NATS.Client.Core
Assembly
NATS.Client.Core.dll

PublishAsync<T>(in NatsMsg<T>, INatsSerialize<T>?, NatsPubOpts?, CancellationToken)

Publishes a serializable message payload to the given subject name, optionally supplying a reply subject.

ValueTask PublishAsync<T>(in NatsMsg<T> msg, INatsSerialize<T>? serializer = null, NatsPubOpts? opts = null, CancellationToken cancellationToken = default)

Parameters

msg NatsMsg<T>

A NatsMsg<T> representing message details.

serializer INatsSerialize<T>

Serializer to use for the message type.

opts NatsPubOpts

A NatsPubOpts for publishing options.

cancellationToken CancellationToken

A CancellationToken used to cancel the command.

Returns

ValueTask

A ValueTask that represents the asynchronous send operation.

Type Parameters

T

Specifies the type of data that may be sent to the NATS Server.