🎄 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

Setikam
Setikam Member Posts: 2
edited December 2021 in General Discussions #1

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

  • Setikam
    Setikam Member Posts: 2
    #2 Answer ✓

    I found out the problem and it is working now. Producer while serialising the message, they have not done in right way. It is solved. Thank you

Answers

  • Setikam
    Setikam Member Posts: 2
    #3 Answer ✓

    I found out the problem and it is working now. Producer while serialising the message, they have not done in right way. It is solved. Thank you

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 963 admin

    Glad you solved it and thanks for letting us know @Setikam 🙏

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 644 admin

    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.