So I'm sending an object using Spring and IBM MQ Queue:
public void sendObjectMessage(final Object message) {
// jmsTemplate.convertAndSend(message);
jmsTemplate.send(new MessageCreator()
{
public Message createMessage(Session session) throws JMSException
{
ObjectMessage outMessage = session.createObjectMessage((Serializable) message);
return(outMessage);
}
});
}
And during debugging I can see that I am indeed sending it as an object message. But using Spring's listener implementation I am picking up the messages in the onMessage() method as JMSBytesMessages????
public void onMessage(Message message) {
System.out.println(">>>>>>> Recieved in onMessage");
System.out.println(message.getClass());
}
OUTPUT:
>>>>>>> Recieved in onMessage
class com.ibm.jms.JMSBytesMessage
Anybody know whats going on here? This is difficult to debug as it seems to be happening on the queue???
Thanks for your help
P.S I've also tried to catch the message using
if (message instanceof ObjectMessage) {
object = ((ObjectMessage) message).getObject();
}
and
if (message instanceof JMSBytesMessage) {
System.out.println("ITS A BYTES MESSAGE!!!!!!!!!!!");
}
Neither of which work???