GH-10990: Fix MQTT v5 inbound payload conversion#11001
Open
adwantg wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10990.
Mqttv5PahoMessageDrivenChannelAdapterwas usingSmartMessageConverter.toMessage(...)whenpayloadTypewas configured for inbound MQTT v5 messages. That path builds a SpringMessagefrom an object, so converters such asStringMessageConvertercould leave the MQTT payload asbyte[]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 forMqttMessageandbyte[]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