Table of Contents

Method ReplyAsync

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

ReplyAsync(NatsHeaders?, string?, NatsPubOpts?, CancellationToken)

Reply with an empty message.

public ValueTask ReplyAsync(NatsHeaders? headers = null, string? replyTo = null, NatsPubOpts? opts = null, CancellationToken cancellationToken = default)

Parameters

headers NatsHeaders

Optional message headers.

replyTo string

Optional reply-to subject.

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.

ReplyAsync<TReply>(TReply, NatsHeaders?, string?, INatsSerialize<TReply>?, NatsPubOpts?, CancellationToken)

Reply to this message.

public ValueTask ReplyAsync<TReply>(TReply data, NatsHeaders? headers = null, string? replyTo = null, INatsSerialize<TReply>? serializer = null, NatsPubOpts? opts = null, CancellationToken cancellationToken = default)

Parameters

data TReply

Serializable data object.

headers NatsHeaders

Optional message headers.

replyTo string

Optional reply-to subject.

serializer INatsSerialize<TReply>

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

TReply

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

Remarks

Publishes a new message using the reply-to subject from the this message as the destination subject.

If the serializer is not specified, the INatsSerializerRegistry assigned to the NatsConnection will be used to find a serializer for the type TReply. You can specify a INatsSerializerRegistry in NatsOpts when creating a NatsConnection. If not specified, NatsDefaultSerializerRegistry will be used.

ReplyAsync<TReply>(NatsMsg<TReply>, INatsSerialize<TReply>?, NatsPubOpts?, CancellationToken)

Reply to this message.

public ValueTask ReplyAsync<TReply>(NatsMsg<TReply> msg, INatsSerialize<TReply>? serializer = null, NatsPubOpts? opts = null, CancellationToken cancellationToken = default)

Parameters

msg NatsMsg<TReply>

A NatsMsg<T> representing message details.

serializer INatsSerialize<TReply>

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

TReply

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

Remarks

Publishes a new message using the reply-to subject from the this message as the destination subject.