The MQSetMessageHeaders function creates the header part of the message.
MQSetMessageHeaders (const MQMessageHandle messageHandle MQPropertiesHandle headersHandle); |
MQStatus. See the MQStatusIsError() function for more information.
A handle to a message.
A handle to the header properties object. This handle will be invalid after the function returns.
After you have created a properties handle and defined values for message header properties using one of the MQSet...Property functions, you can pass the handle to the MQSetMessageHeaders function to define the message header properties.
The message header properties are described in the table below. For sending messages, the client can only set two of these: the correlation ID property and the message type property. The client is not required to set these; they are provided for the client’s convenience. For example, the client can use the key MQ_MESSAGE_TYPE_HEADER_PROPERTY to sort incoming messages according to application-defined message types.
Table 4–6 Message Header Properties
Key |
Type |
Set By |
||
---|---|---|---|---|
|
|
Client (optional) |
||
|
|
Client (optional) |
||
|
|
Send function |
||
|
|
Send function |
||
|
|
Send function |
||
|
|
Send function |
||
|
|
Send function |
||
|
|
Message Broker |
Header properties that are not specified in the headersHandle are not affected. You cannot use this function to override header properties that are set by the broker or the send function. The header properties for persistence, expiration, and priority (MQSetMessageHeaders)() are set to default values if the user called the MQSendMessage() or MQSendMessageToDestination() function, or they are set to values the user specifies (in parameters) if the user called the MQSendMessageExt() or the MQSendMessageToDestinationExt() function.
Use the MQSetBytesMessageBytes() function or the MQSetTextMessageText() function to set the body of a message. Use the MQSetMessageProperties() function to set the application-defined properties of a message that are not part of the header.
MQ_PROPERTY_WRONG_VALUE_TYPE