Using the IBM MQ Headers package

The IBM® MQ Headers package provides a set of helper interfaces and classes that you can use to manipulate the IBM MQ headers of a message. Typically, you use the IBM MQ Headers package because you want to perform administrative services by using the command server (by using Programmable Command Format (PCF) messages).

About this task

The IBM MQ Headers package is located in the com.ibm.mq.headers and com.ibm.mq.headers.pcf packages. You can use this facility for both of the two alternative APIs that IBM MQ provides for use in Java applications:
  • IBM MQ classes for Java (also referred to as IBM MQ Base Java).
  • IBM MQ classes for Java Message Service (IBM MQ classes for JMS, also referred to as IBM MQ JMS).

IBM MQ Base Java applications typically manipulate MQMessage objects, and the Headers support classes can directly interact with these objects, since they natively understand the IBM MQ Base Java interfaces.

In IBM MQ JMS, the payload for a message is typically a String or a byte array object, which can be manipulated with DataInput and DataOutput streams. The IBM MQ Headers package can be used to interact with these data streams and is suitable for manipulating any MQ messages that are sent and received by IBM MQ JMS applications.

Therefore, although the IBM MQ Headers package contains references to the IBM MQ Base Java package, it is also intended for use within IBM MQ JMS applications and is suitable for use within Java Platform, Enterprise Edition (Java EE) environments.

A typical way in which you might use the IBM MQ Headers package is to manipulate administration messages in Programmable Command Format (PCF), for example for any of the following reasons:
  • To access details about an IBM MQ resource.
  • To monitor the depth of a queue.
  • To inhibit access to a queue.
By using PCF messages with the IBM MQ JMS API, this kind of administration of application-centric resources can be performed from within Java EE applications without having to resort to using the IBM MQ Base Java API.