Skip to content

MQTT v5 PUBLISH properties are dropped: Resources cannot read them and subscribers never receive them #3535

Open

Description

@kriszyp

Problem

Harper drops every MQTT v5 PUBLISH property. They are parsed into packet.properties, but neither side of the broker uses them:

  • Inbound: publishMessage (DurableSubscriptionsSession.ts) passes only message.data to resource.publish(target, data, context) / put. A Resource cannot read User Properties, Correlation Data, Response Topic, Content Type or Message Expiry Interval.
  • Outbound: deliveries to subscribers carry none of them, so the client receives no User Properties, Response Topic or Correlation Data.

MQTT 5.0 §3.3.2.3 requires the server to forward User Properties, Response Topic, Correlation Data, Payload Format Indicator and Content Type unaltered to subscribers, and to send Message Expiry Interval as the remaining lifetime. Nothing fails or logs; the properties are simply absent.

Impact

  • MQTT 5 request/response does not work through Harper. The pattern depends on Response Topic plus Correlation Data reaching the responder.
  • Application metadata is lost. A Resource cannot read an idempotency key, trace id or tenant tag that a client puts in User Properties. That forces those values into the payload, which changes the payload format clients already use.

Proposed change

  1. Inbound: expose the publish properties to the Resource method. For example, set context.mqtt = { properties } for the call, or pass them in a publish options argument. The Resource.publish(target, message, context) signature stays the same.
  2. Outbound: store the forwardable properties with the published message, and emit them on delivery. This covers live delivery, durable-session replay and retained messages. Message Expiry Interval is sent as the remaining lifetime.
  3. Limits: apply the existing packet-size limits to the properties, so they are not an unbounded side channel.

Item 1 is small and independently useful. Item 2 changes what is stored per message, so it needs a storage-format decision; it can ship as a separate PR.

Acceptance

  • A Resource publish override can read an inbound PUBLISH's User Properties and Correlation Data.
  • A v5 subscriber receives User Properties, Response Topic, Correlation Data, Content Type and Payload Format Indicator unaltered, for live delivery, durable-session replay and retained messages.
  • A v3.1.1 subscriber is unaffected.
  • The QoS 0 path writes nothing new when the publish carries no properties.

Filed by Claude (Opus 5.5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Fields

    Priority

    P2

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions