IBM Support

WebSphere MQ message properties go missing on JMS messages

Troubleshooting


Problem

You have a JMS application that is connecting to a WebSphere MQ V7 queue manager. Your application constructs a JMS message, adds some properties to that message and then sends it to a JMS Destination that maps to a queue on the queue manager. However, when the message arrives on the Destination, the message properties have been lost.

Cause

WebSphere MQ V7 introduced a new JMS Destination property called MSGBODY, which controls whether JMS messages should include MQRFH2 headers.

When this property is set to the value MQ, any JMS messages sent to this Destination will not contain an MQRFH2 header.

If the property is set to the value JMS, then JMS messages sent to this Destination will have an MQRFH2 header on them.

The default value of this property is Unspecified. This means that the decision of whether to add an MQHRF2 header to the JMS message is based on the value of the Destination property TARGCLIENT. If TARGCLIENT is set to MQ, then messages sent to this Destination will not have an MQRFH2 header. If TARGCLIENT has the value JMS, then the MQRFH2 header will be included on any messages sent to the Destination.

When a JMS application creates a message, that message will contain a WebSphere MQ Message Descriptor (MQMD) and a MQRFH2 header as well as the message body. An application can then set properties on the message, by calling one or more of the following methods:

  • void setBooleanProperty(String name,boolean value)
  • void setByteProperty(String name,byte value)
  • void setDoubleProperty(String name,double value)
  • void setFloatProperty(String name,float value)
  • void setIntProperty(String name,int value)
  • void setLongProperty(String name,long value)
  • void setObjectProperty(String name,Object value)
  • void setShortProperty(String name,short value)
  • void setStringProperty(String name,String value)

Some properties that can be set on a JMS message map onto fields in the MQMD. Properties that do not map to a field in the MQMD will be stored in the MQRFH2 header. Information about which properties map to fields in the MQMD can be found in the following sections of the product documentation in Knowledge Center:

Now, if this message is then sent to a JMS Destination that has:
  • either the MSGBODY property set to MQ
  • or the MSGBODY property set to Unspecified and the TARGCLIENT property set to MQ

then the MQRFH2 header will be removed from the message before it arrives on the WebSphere MQ queue that the Destination maps to. This means that any properties that were set on the message before it was sent that did not map to fields in the MQMD are lost.

Environment

The issue documented here can affect applications that connect to a WebSphere MQ V7 queue manager using either WebSphere MQ messaging provider normal mode or WebSphere MQ messaging provider migration mode in one of the environments shown below:

  • The WebSphere MQ V7 classes for JMS.
  • The WebSphere MQ V7 Resource Adapter.
  • The WebSphere MQ V7 OSGi bundles.
  • The WebSphere Application Server V8 WebSphere MQ messaging provider.
  • The WebSphere Application Server V7 WebSphere MQ messaging provider.
  • The WebSphere Application Server V6.1 WebSphere MQ messaging provider who have configured the WebSphere variable MQ_INSTALL_ROOT to point to a WebSphere MQ V7 installation.

Resolving The Problem

To resolve the issue, ensure that the JMS Destination that the message is sent to has:

  • either the MSGBODY property set to JMS.
  • or the MSGBODY property set to Unspecified and the TARGCLIENT property set to JMS.

[{"Product":{"code":"SSFKSJ","label":"WebSphere MQ"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Java","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"},{"code":"PF035","label":"z\/OS"}],"Version":"7.1;7.0","Edition":"All Editions","Line of Business":{"code":"LOB45","label":"Automation"}}]

Product Synonym

WMQ WebSphere MQ MQSeries MQS

Document Information

Modified date:
15 June 2018

UID

swg21573858