+

Search Tips | Advanced Search

Handling messages greater than 4 MB long

Messages can be too large for the application, queue, or queue manager. Depending on the environment, IBM MQ provides a number of ways of dealing with messages that are longer than 4 MB.

We can increase the MaxMsgLength attribute up to 100 MB on all IBM MQ systems at V6 or later. Set this value to reflect the size of the messages using the queue. On IBM MQ systems other than IBM MQ for z/OSĀ®, we can also:
  1. Use segmented messages. (Messages can be segmented by either the application or the queue manager.)
  2. Use reference messages.

Each of these approaches is described in the remainder of this section.


Increasing the maximum message length

The MaxMsgLength queue manager attribute defines the maximum length of a message that can be handled by a queue manager. Similarly, the MaxMsgLength queue attribute is the maximum length of a message that can be handled by a queue. The default maximum message length supported depends on the environment in which you are working.

If you are handling large messages, we can alter these attributes independently on platforms other than z/OS. We can set the queue manager attribute value in the range 32768 bytes through 100 MB. Attention: On IBM MQ for z/OS the MaxMsgLength attribute of the queue manager is hard coded at 100 MB.

On all platforms, we can set the queue attribute value in the range 0 through 100 MB.

After changing one or both of the MaxMsgLength attributes, restart our applications and channels to ensure that the changes take effect.

When these changes are made, the message length must be less than or equal to both the queue and the queue manager MaxMsgLength attributes. However, existing messages might be longer than either attribute.

If the message is too big for the queue, MQRC_MSG_TOO_BIG_FOR_Q is returned. Similarly, if the message is too big for the queue manager, MQRC_MSG_TOO_BIG_FOR_Q_MGR is returned.

This method of handling large messages is easy and convenient. However, consider the following factors before using it: