namespace NATS.Server.Mqtt; /// /// JetStream API helper context for MQTT account/session operations. /// Go reference: mqtt.go mqttJSA. /// public sealed class MqttJsa { /// Account that owns the MQTT JetStream operations. public string AccountName { get; set; } = string.Empty; /// Reply subject prefix used for MQTT JetStream API calls. public string ReplyPrefix { get; set; } = string.Empty; /// Optional JetStream domain for cross-domain routing. public string? Domain { get; set; } } /// /// MQTT JetStream publish request shape. /// Go reference: mqtt.go mqttJSPubMsg. /// public sealed class MqttJsPubMsg { /// Target NATS subject for the publish operation. public string Subject { get; set; } = string.Empty; /// Published payload bytes. public byte[] Payload { get; set; } = []; /// Optional reply subject for request/reply semantics. public string? ReplyTo { get; set; } } /// /// Retained-message delete notification payload. /// Go reference: mqtt.go mqttRetMsgDel. /// public sealed class MqttRetMsgDel { /// MQTT topic whose retained message should be removed. public string Topic { get; set; } = string.Empty; /// JetStream sequence of the retained message record. public ulong Sequence { get; set; } } /// /// Persisted MQTT session metadata. /// Go reference: mqtt.go mqttPersistedSession. /// public sealed class MqttPersistedSession { /// MQTT client identifier for the persisted session. public string ClientId { get; set; } = string.Empty; /// Last issued packet identifier for this session. public int LastPacketId { get; set; } /// Maximum number of unacknowledged QoS deliveries allowed. public int MaxAckPending { get; set; } } /// /// Reference to a retained message in storage. /// Go reference: mqtt.go mqttRetainedMsgRef. /// public sealed class MqttRetainedMessageRef { /// JetStream sequence containing the retained MQTT payload. public ulong StreamSequence { get; set; } /// NATS subject mapped from the retained MQTT topic. public string Subject { get; set; } = string.Empty; } /// /// MQTT subscription metadata. /// Go reference: mqtt.go mqttSub. /// public sealed class MqttSub { /// MQTT topic filter for this subscription. public string Filter { get; set; } = string.Empty; /// Requested MQTT QoS level. public byte Qos { get; set; } /// Optional JetStream durable consumer name. public string? JsDur { get; set; } /// Indicates whether this is a permanent subscription. public bool Prm { get; set; } /// Reserved flag kept for Go protocol parity. public bool Reserved { get; set; } } /// /// Parsed MQTT filter metadata. /// Go reference: mqtt.go mqttFilter. /// public sealed class MqttFilter { /// Original MQTT topic filter. public string Filter { get; set; } = string.Empty; /// QoS level attached to the filter. public byte Qos { get; set; } /// Parsed token optimization hint used for dispatch lookups. public string? TopicToken { get; set; } } /// /// Parsed NATS headers associated with an MQTT publish flow. /// Go reference: mqtt.go mqttParsedPublishNATSHeader. /// public sealed class MqttParsedPublishNatsHeader { /// Subject extracted from MQTT publish headers, when present. public string? Subject { get; set; } /// Mapped subject after account/topic translation. public string? Mapped { get; set; } /// Indicates the packet represents a PUBLISH flow. public bool IsPublish { get; set; } /// Indicates the packet represents a PUBREL flow. public bool IsPubRel { get; set; } }