Set properties of a message

Call MQSETMP for each property we want to set. When you put the message set the message handle and action fields of the MQPMO structure.

To associate properties with a message, the message must have a message handle. Create a message handle using the MQCRTMH function call. Call MQSETMP specifying this message handle for each property we want to set. A sample program, amqsstma.c, is provided to illustrate the use of MQSETMP.

If this is a new message, when you put it to a queue, using MQPUT or MQPUT1, set the OriginalMsgHandle field in the MQPMO to the value of this message handle, and set the MQPMO Action field to MQACTP_NEW (this is the default value).

If this is a message you have previously retrieved, and we are now forwarding or replying to it or sending a report in response to it, put the original message handle in the OriginalMsgHandle field of the MQPMO and the new message handle in the NewMsgHandle field. Set the Action field to MQACTP_FORWARD, MQACTP_REPLY, or MQACTP_REPORT, as appropriate.

If we have properties in an MQRFH2 header from a message you have previously retrieved, we can convert them to message handle properties using the MQBUFMH call.

If we are putting your message to a queue on a queue manager at a level earlier than IBM WebSphere MQ Version 7.0, which cannot process message properties, we can set the PropertyControl parameter in the channel definition to specify how the properties are to be treated.

Parent topic: Put messages on a queue