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