🎄 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.
Message published but cant figure out the error.
Hello I am new to Solace. I want to publish messages to solace.
I have messages in JSON format which I convert in bytes and then publish it. At the receiver's end we can see that the messgae is receieved but I get the following error.
"Exception is class com.solacesystems.jms.message.SolMessage cannot be cast to class com.solacesystems.jms.message.SolBytesMessage (com.solacesystems.jms.message.SolMessage and com.solacesystems.jms.message.SolBytesMessage are in unnamed module of loader 'app')
ABC Number is null
Found a Text encoded message "
I am using python script to do this. Please if someone could help and have face similar issues earlier. Let me know.
Answers
-
It sounds like you're trying to consume your Python-published message using JMS? Trying to guess from your exception / error text above, are you trying to cast a received JMS message to a
BytesMessage
without checking if it is..? Looks like it could be aTextMessage
.Maybe your JMS consumer needs to do something like:
if (msg instanceof TextMessage) { TextMessage txt = (TextMessage)msg; String payload = txt.getText(); // more here } else if (msg instanceof BytesMessage) { BytesMessage bytes = (BytesMessage)msg; // more here } else // blah blah
Also, when you mention you want to "convert your JSON to bytes", what does that mean? Like, serialize it to AVRO as a binary format payload? Or just send the JSON string as a binary message? Or ..?
1