Spring / Spring Integration
Merged upstreamCorrectnessMerged May 28, 2026

Fix MQTT v5 inbound payload conversion

Corrected MQTT v5 inbound payload conversion so configured payload types are honored by the Spring Messaging converter contract.

spring-projects/spring-integration · #11001

Problem

The inbound MQTT v5 adapter used SmartMessageConverter.toMessage(...) when payloadType was configured. That is the outbound conversion path, so String payload targets could remain byte[] and JSON content could surface as confusing Base64 text.

Approach

Built an inbound Spring Message from the MQTT payload, converted it with SmartMessageConverter.fromMessage(...), preserved byte[] and MqttMessage pass-through behavior, and documented the breaking-change semantics for custom converters.

Impact and scope

  • Restores predictable MQTT v5 inbound conversion for Spring Integration applications that configure a target payload type.
  • Aligns adapter behavior with the Spring Messaging converter contract, reducing silent byte[] and Base64 payload surprises.
  • Documents the behavior change so framework users with custom converters can migrate intentionally.

Validation

  • Added a regression test proving String payloadType conversion for inbound MQTT v5 messages.
  • Adjusted back-to-back MQTT tests to match inbound byte-to-string conversion semantics.
  • Documented the MQTT v5 converter behavior in the Spring Integration reference changes.