Skip to content

GH-10990: Fix MQTT v5 inbound payload conversion#11001

Open
adwantg wants to merge 1 commit into
spring-projects:mainfrom
adwantg:GH-10990
Open

GH-10990: Fix MQTT v5 inbound payload conversion#11001
adwantg wants to merge 1 commit into
spring-projects:mainfrom
adwantg:GH-10990

Conversation

@adwantg
Copy link
Copy Markdown

@adwantg adwantg commented May 11, 2026

Fixes #10990.

Mqttv5PahoMessageDrivenChannelAdapter was using SmartMessageConverter.toMessage(...) when payloadType was configured for inbound MQTT v5 messages. That path builds a Spring Message from an object, so converters such as StringMessageConverter could leave the MQTT payload as byte[] instead of converting it to the requested payload type.

This changes the non-pass-through path to convert from the inbound Spring Message<?> with the configured target type. The existing behavior for MqttMessage and byte[] payload targets is unchanged.

Tests:

  • ./gradlew :spring-integration-mqtt:test --tests org.springframework.integration.mqtt.Mqttv5AdapterTests.payloadTypeIsUsedForInboundMqttV5PayloadConversion
  • ./gradlew :spring-integration-mqtt:test --tests org.springframework.integration.mqtt.Mqttv5AdapterTests
  • ./gradlew :spring-integration-mqtt:check

Use inbound message conversion when Mqttv5PahoMessageDrivenChannelAdapter is configured with a target payload type.

Fixes: spring-projectsgh-10990
Signed-off-by: Goutam Adwant <workwithgoutam@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mqttv5PahoMessageDrivenChannelAdapter ignores payloadType due to incorrect MessageConverter.toMessage usage

1 participant