🎄 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.
Jms, Spring cloud stream
Can I read the message which was published by solace producer using spring cloud stream, i tried but i am receiving a byte message and getBody of Message interface throws exception.
Even i tried separately as well but got
java.lang.AbstractMethodError: Receiver class com.solacesystems.jms.message.SolBytesMessage does not define or inherit an implementation of the resolved method 'abstract java.lang.Object getBody(java.lang.Class)' of interface javax.jms.Message.
at com.ntpoc.TransactionController.getTransaction(TransactionController.java:54) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
Comments
-
The javax.jms.Message#getBody() is a method on the JMS 2.0 spec. The Solace JMS API supports JMS version 1.1. In order to read the contents of a bytes message you will need to read via the getBytes method.
A simple example:
byte[] bytes = new byte[(int) message.getBodyLength()]; message.readBytes(bytes); return bytes;
You may also use the SolJmsUtility to read the contents. Check out com.solacesystems.jms.SolJmsUtility#dumpMessage(javax.jms.Message msg)
2