Question

I use Spring's JmsTemplate to send an ObjectMessage to a MQ Queue:

this.jmsTemplate.send(this.queue, new MessageCreator() {
    public Message createMessage(Session session) throws JMSException {
        MyPayload payload = new MyPayload();
        payload.setSomething(...);
        return session.createObjectMessage(payload);
    }
 });

The sent message is of type com.ibm.jms.JMSObjectMessage, but the corresponding destination receives a message of type com.ibm.jms.JMSBytesMessage:

Message message = this.jmsTemplate.receive(this.queue);

Any idea, why and where the conversion takes place?

This similar question is not really answered.

Further information: A TextMessage is received as com.ibm.jms.JMSTextMessage, an ObjectMessage with just a string inside is converted to a com.ibm.jms.JMSBytesMessage, too.

Was it helpful?

Solution

Found it, I was using the wrong transport type:

<bean id="mqQueue" class="com.ibm.mq.jms.MQQueue">
    <property name="baseQueueName" value="..." />
    <property name="targetClient">
        <util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ" />
    </property>
</bean>

Instead it should have been:

<bean id="mqQueue" class="com.ibm.mq.jms.MQQueue">
    <property name="baseQueueName" value="..." />
    <property name="targetClient">
        <util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_JMS_COMPLIANT" />
    </property>
</bean>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top