Struct NatsMsg<T>
NATS message structure as defined by the protocol.
public readonly record struct NatsMsg<T> : INatsMsg<T>, IEquatable<NatsMsg<T>>Type Parameters
- T
- Specifies the type of data that may be sent to the NATS Server. 
- Implements
- 
      INatsMsg<T>IEquatable<NatsMsg<T>>
- Inherited Members
- Extension Methods
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;Constructors
- NatsMsg(string, string?, int, NatsHeaders?, T?, INatsConnection?, NatsMsgFlags)
- NATS message structure as defined by the protocol. 
Properties
- Connection
- NATS connection this message is associated to. 
- Data
- Serializable data object. 
- Error
- Any errors (generally serialization errors) encountered while processing the message. 
- Headers
- Pass additional information using name-value pairs. 
- ReplyTo
- The reply subject that subscribers can use to send a response back to the publisher/requester. 
- Size
- Message size in bytes. 
- Subject
- The destination subject to publish to. 
Methods
- Build(string, string?, in ReadOnlySequence<byte>?, in ReadOnlySequence<byte>, INatsConnection?, NatsHeaderParser, INatsDeserialize<T>)
- Builds a new instance of a NatsMsg<T> with the specified parameters. 
- EnsureSuccess()
- Throws an exception if the message contains any errors (generally serialization errors). 
- ReplyAsync(NatsHeaders?, string?, NatsPubOpts?, CancellationToken)
- Reply with an empty message.