Method PublishAsync
PublishAsync<T>(string, T, NatsHeaders?, string?, INatsSerialize<T>?, NatsPubOpts?, CancellationToken)
Publishes a serializable message payload to the given subject name, optionally supplying a reply subject.
ValueTask PublishAsync<T>(string subject, T data, NatsHeaders? headers = null, string? replyTo = null, INatsSerialize<T>? serializer = null, NatsPubOpts? opts = null, CancellationToken cancellationToken = default)
Parameters
subject
stringThe destination subject to publish to.
data
TSerializable data object.
headers
NatsHeadersOptional message headers.
replyTo
stringOptional reply-to subject.
serializer
INatsSerialize<T>Serializer to use for the message type.
opts
NatsPubOptsA NatsPubOpts for publishing options.
cancellationToken
CancellationTokenA CancellationToken used to cancel the command.
Returns
Type Parameters
T
Specifies the type of data that may be sent to the NATS Server.
PublishAsync(string, NatsHeaders?, string?, NatsPubOpts?, CancellationToken)
Publishes an empty message payload to the given subject name, optionally supplying a reply subject.
ValueTask PublishAsync(string subject, NatsHeaders? headers = null, string? replyTo = null, NatsPubOpts? opts = null, CancellationToken cancellationToken = default)
Parameters
subject
stringThe destination subject to publish to.
headers
NatsHeadersOptional message headers.
replyTo
stringOptional reply-to subject.
opts
NatsPubOptsA NatsPubOpts for publishing options.
cancellationToken
CancellationTokenA CancellationToken used to cancel the command.
Returns
Remarks
Publishing a sentinel usually means a signal to the given subject which could be used to trigger an action or indicate an event for example and of messages.