How To Configure WebSphere MQ 6.0 To Recognize MQSTR Headers

An oft seen tussle with WebSphere MQ is recognition of the MQSTR or MQRFH2 headers in the received message. A non-JMS application would like to receive the message only with MQSTR headers, while a JMS application can process messages with MQRFH2 headers.

Diagrammatic Mapping of  the Headers - 

The WebSphere MQ message has three components:

  • Message Queue Message Descriptor (MQMD)

This contains the control information. If this header is missing, the message is rejected.

  • MQRFH2 Header

This header is optional and text format messages. For JMS format messages, it contains JMS-specific properties like JMSDestination, JMSExpiration, JMSCorrelationID, etc. e.g. a few clients may use the JMSCorrelationID to integrate messages with other JMS clients. Such headers would make no sense to a non-JMS client.

  • Message/Application Data

This contains information about the message encoding, which depends on the type of JMS message.

WebSphere MQ recognizes the types of the header on the received message through the Target Client property. This property can be configured to hold two values:

  • JMS or “0”

When set to JMS, the message is for a JMS client and includes the MQRFH2 header

  • MQ or “1”

When set to MQ, the message is for a non-JMS client and includes only the MQSTR header

Changing the Queue properties

One can configure the queues either programmatically or on the WebSphere MQ server. In this article, we show how to configure the queues on the WebSphere MQ server by changing the queue bindings in the JNDI context.

One can bind different queues on the same queue manager to receive MQRFH2 or MQSTR headers . To create the bindings file as specified in the JMSAdmin.config file, execute the below commands with appropriate values through the JMSAdmin utility.

In the following example, the port number and the IP address are same for both the commands.

Here, Q1 will accept both types of headers (MQSTR and MQRFH2) and Q2 queue will accept only MQSTR headers.

We hope that you find the information presented here useful. Feel free to let us know of any issues, feedback and suggestions in the comments section below.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">