Using Spring boot 1.5.9 and JMS 2.0.1 with Java 9.0.....
Talking with IBM's MQ (version 9) with their MQQueueConnectionFactory
which delivers to an @JmsListener
an com.ibm.jms.JMSMessage
that extends the javax.jms.Message
class. This means the normal type reflection by a MessageConverter
isn't used. Not sure where in the Spring JMS pipeline I can transform the JMSMessage into a normal Message and then activate conversion? When testing I would like to use an embedded active mq that produces Message
objects not JMSMessage
.
Thus it would be great if the annotated receiver method accepted Message
not JMSMessage
.
Update 1
The following signature has to be used otherwise the Spring pipeline fails with no defined MessageConverter for a IBM JMSMessage
:
@JmsListener(destination = "${mq.queue}")
public void receive(
JMSMessage message,
@Header(JmsHeaders.MESSAGE_ID) String messageId
) ... {
....
}
I want to have a signature that looks like:
@JmsListener(destination = "${mq.queue}")
public void receive(
Message message,
@Header(JmsHeaders.MESSAGE_ID) String messageId
) ... {
....
}
Otherwise, when testing (with an embedded jms queue manager) the receiving method doesn't have a consistent signature. Must exist a spot in the Spring JMS pipeline (e.g. MessageListener) where I can intercept the JMSMessage
, pull out it's delegate Message
and send that onto the JmsListener
.
Update 2
False alarm. Redid tests with a live configuration and a receive signature that accepts a plain java.jmx.Message
and just as M.D. pointed out it worked. As well, the default simple message converter that uses the ClassUtils to turn the underlying JMSTextMessage into a string.