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
subjectstringThe destination subject to publish to.
dataTSerializable data object.
headersNatsHeadersOptional message headers.
replyTostringOptional reply-to subject.
serializerINatsSerialize<T>Serializer to use for the message type.
optsNatsPubOptsA NatsPubOpts for publishing options.
cancellationTokenCancellationTokenA CancellationToken used to cancel the command.
Returns
Type Parameters
TSpecifies 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
subjectstringThe destination subject to publish to.
headersNatsHeadersOptional message headers.
replyTostringOptional reply-to subject.
optsNatsPubOptsA NatsPubOpts for publishing options.
cancellationTokenCancellationTokenA 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.