🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
We see some junk characters while deserialising the message
Hi Team,
I have question about junk characters in the payload message. In our use case, we consume the message from solace topics.
As part of solution, we used spring cloud stream,
fun consumer(): Consumer<Message> , the string payload when we log it, it is having junk characters like G?teborg instead of Götenborg example
We tried to decoded with UTF-8 but no luck, Is there something which we are missing. Has anyone seen this issue before? Any leads or support appreciated. Thank you
Best Answer
Answers
-
If anyone stumbles on this: probably the publisher was sending as TextMessage, which in Solace is a Structured Data Type (SDT) payload, where there is a single string wrapped with some additional bytes to indicate length. When deserializing, if the consumer just assumes the whole (binary blob) payload is a String, it'll see some extra junk chars. The consumer either needs to consume / cast as a Text Message (if using Solace APIs), or the publisher needs to publish a Bytes / binary message with the string as payload. If using REST Messaging, the "content type" probably needs to be set to
text/plain
.0