Constructor NatsMsg
NatsMsg(string, string?, int, NatsHeaders?, T?, INatsConnection?, NatsMsgFlags)
NATS message structure as defined by the protocol.
public NatsMsg(string subject, string? replyTo, int size, NatsHeaders? headers, T? data, INatsConnection? connection, NatsMsgFlags flags = NatsMsgFlags.None)
Parameters
subjectstringThe destination subject to publish to.
replyTostringThe reply subject that subscribers can use to send a response back to the publisher/requester.
sizeintMessage size in bytes.
headersNatsHeadersPass additional information using name-value pairs.
dataTSerializable data object.
connectionINatsConnectionNATS connection this message is associated to.
flagsNatsMsgFlagsMessage flags to indicate no responders and empty payloads.
Remarks
Connection property is used to provide reply functionality.
Message size is calculated using the same method NATS server uses:
int size = subject.Length + replyTo.Length + headers.Length + payload.Length;