Method ReplyAsync
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
NatsHeadersOptional message headers.
replyTo
stringOptional reply-to subject.
opts
NatsPubOptsA NatsPubOpts for publishing options.
cancellationToken
CancellationTokenA CancellationToken used to cancel the command.
Returns
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
TReplySerializable data object.
headers
NatsHeadersOptional message headers.
replyTo
stringOptional reply-to subject.
serializer
INatsSerialize<TReply>Serializer to use for the message type.
opts
NatsPubOptsA NatsPubOpts for publishing options.
cancellationToken
CancellationTokenA CancellationToken used to cancel the command.
Returns
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
NatsPubOptsA NatsPubOpts for publishing options.
cancellationToken
CancellationTokenA CancellationToken used to cancel the command.
Returns
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.