+

Search Tips | Advanced Search

Message properties

Use message properties to allow an application to select messages to process, or to retrieve information about a message without accessing MQMD or MQRFH2 headers. They also facilitate communication between IBM MQ and JMS applications.

A message property is data associated with a message, consisting of a textual name and a value of a particular type. Message properties are used by message selectors to filter publications to topics or to selectively get messages from queues. Message properties can be used to include business data or state information without having to store it in the application data. Applications do not have to access data in the MQ Message Descriptor (MQMD) or MQRFH2 headers because fields in these data structures can be accessed as message properties using Message Queue Interface (MQI) function calls.

The use of message properties in IBM MQ mimics the use of properties in JMS. This means that we can set properties in a JMS application and retrieve them in a procedural IBM MQ application, or the other way round. To make a property available to a JMS application, assign it the prefix "usr"; it is then available (without the prefix) as a JMS message user property. For example, the IBM MQ property usr.myproperty (a character string) is accessible to a JMS application using the JMS call message.getStringProperty('myproperty'). Note that JMS applications are unable to access properties with the prefix "usr" if they contain two or more U+002E (".") characters. A property with no prefix and no U+002E (".") character is treated as if it had the prefix "usr". Conversely, a user property set in a JMS application can be accessed in an IBM MQ application by adding the "usr." prefix to the property name inquired on in an MQINQMP call.

  • Message properties and message length
    Use the queue manager attribute MaxPropertiesLength to control the size of the properties that can flow with any message in an IBM MQ queue manager.
  • Property names
    A property name is a character string. Certain restrictions apply to its length and the set of characters that can be used.
  • Property data types and values
    A property can be a boolean, a byte string, a character string, or a floating-point or integer number. The property can store any valid value in the range of the data type unless otherwise restricted by the context.

Parent topic: IBM MQ messages

Last updated: 2020-10-04