Method ReplyErrorAsync
ReplyErrorAsync<TReply>(int, string, TReply, NatsHeaders?, string?, INatsSerialize<TReply>?, NatsPubOpts?, CancellationToken)
Reply with an error and additional data as error body.
public ValueTask ReplyErrorAsync<TReply>(int code, string message, TReply data, NatsHeaders? headers = null, string? replyTo = null, INatsSerialize<TReply>? serializer = null, NatsPubOpts? opts = null, CancellationToken cancellationToken = default)
Parameters
code
intError code.
message
stringError message.
data
TReplyError body.
headers
NatsHeadersOptional additional headers.
replyTo
stringOptional reply-to subject.
serializer
INatsSerialize<TReply>Serializer to use for the message type.
opts
NatsPubOptsOptional publishing options.
cancellationToken
CancellationTokenA CancellationToken used to cancel the API call.
Returns
Type Parameters
TReply
A serializable type as data.
ReplyErrorAsync(int, string, NatsHeaders?, string?, NatsPubOpts?, CancellationToken)
Reply with an error.
public ValueTask ReplyErrorAsync(int code, string message, NatsHeaders? headers = null, string? replyTo = null, NatsPubOpts? opts = null, CancellationToken cancellationToken = default)
Parameters
code
intError code.
message
stringError message.
headers
NatsHeadersOptional additional headers.
replyTo
stringOptional reply-to subject.
opts
NatsPubOptsOptional publishing options.
cancellationToken
CancellationTokenA CancellationToken used to cancel the API call.