Handling message properties

Message properties allow you to select messages, or to retrieve information about a message without accessing its headers. The MQMessage class contains methods to get and set properties.

You can 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. For more information about message properties in IBM MQ, see Message properties.

The MQMessage class provides a number of methods to get and set properties, according to the data type of the property. The get methods have names of the format Get*Property, and the set methods have names of the format Set*Property, where the asterisk (*) represents one of the following strings:
  • Boolean
  • Byte
  • Bytes
  • Double
  • Float
  • Int
  • Int2
  • Int4
  • Int8
  • Long
  • Object
  • Short
  • String

For example, to get the IBM MQ property myproperty (a character string), use the call message.GetStringProperty('myproperty'). You can optionally pass a property descriptor, which IBM MQ will complete.