+

Search Tips | Advanced Search

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.

In general, when we use MQSETMP to set properties, the size of a property is the length of the property name in bytes, plus the length of the property value in bytes as passed into the MQSETMP call. It is possible for the character set of the property name and the property value to change during transmission of the message to its destination because these can be converted into Unicode; in this case the size of the property might change.

On an MQPUT or MQPUT1 call, properties of the message do not count toward the length of the message for the queue and the queue manager, but they do count toward the length of the properties as perceived by the queue manager (whether they were set using the message property MQI calls or not).

If the size of the properties exceeds the maximum properties length, the message is rejected with MQRC_PROPERTIES_TOO_BIG. Because the size of the properties is dependent on its representation, we should set the maximum properties length at a gross level.

It is possible for an application to successfully put a message with a buffer that is larger than the value of MaxMsgLength, if the buffer includes properties. This is because, even when represented as MQRFH2 elements, message properties do not count toward the length of the message. The MQRFH2 header fields add to the properties length only if one or more folders are contained and every folder in the header contains properties. If one or more folders are contained in the MQRFH2 header and any folder does not contain properties, the MQRFH2 header fields count toward the message length instead.

On an MQGET call, properties of the message do not count toward the length of the message as far as the queue and the queue manager are concerned. However, because the properties are counted separately it is possible that the buffer returned by an MQGET call is larger than the value of the MaxMsgLength attribute.

Do not have the applications query the value of MaxMsgLength and then allocate a buffer of this size before calling MQGET; instead, allocate a buffer you consider large enough. If the MQGET fails, allocate a buffer guided by the size of the DataLength parameter.

The DataLength parameter of the MQGET call returns the length in bytes of the application data and any properties returned in the buffer you have provided, if a message handle is not specified in the MQGMO structure.

The Buffer parameter of the MQPUT call contains the application message data to be sent and any properties represented in the message data.

When flowing to a queue manager that is earlier than Version 7.0 of the product, properties of the message, except those in the message descriptor, count toward the length of the message. Therefore, we should either raise the value of the MaxMsgLength attribute of channels going to a system earlier than Version 7.0 as necessary, to compensate for the fact that more data might be sent for each message. Alternatively, we can lower the queue or queue manager MaxMsgLength, so that the overall level of data being sent around the system remains the same.

There is a length limit of 100 MB for message properties, excluding the message descriptor or extension for each message.

The size of a property in its internal representation is the length of the name, plus the size of its value, plus some control data for the property. There is also some control data for the set of properties after one property is added to the message.

Parent topic: Message properties

Last updated: 2020-10-04