Table of Contents

Constructor NatsMsg

Namespace
NATS.Client.Core
Assembly
NATS.Client.Core.dll

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

subject string

The destination subject to publish to.

replyTo string

The reply subject that subscribers can use to send a response back to the publisher/requester.

size int

Message size in bytes.

headers NatsHeaders

Pass additional information using name-value pairs.

data T

Serializable data object.

connection INatsConnection

NATS connection this message is associated to.

flags NatsMsgFlags

Message 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;