Handling messages greater than 4 MB

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 larger than 4 MB. The maximum message size is 100 MB.

About this task

You can increase the MaxMsgLength queue and queue manager attributes to reflect the size of the messages using the queue, up to a maximum message size of 100 MB. This method of handling large messages is easy and convenient. However, consider the following factors before using it:
  • Uniformity among queue managers is reduced. The maximum size of message data is determined by the MaxMsgLength for each queue (including transmission queues) on which the message will be put. This value is often defaulted to the queue manager's MaxMsgLength, especially for transmission queues. This makes it difficult to predict whether a message is too large when it is to travel to a remote queue manager.
  • Usage of system resources is increased. For example, applications need larger buffers, and on some platforms there might be increased usage of shared storage. Queue storage is affected only if actually required for larger messages.
  • Channel batching is affected. A large message still counts as just one message towards the batch count but needs longer to transmit, thereby increasing response times for other messages.
[UNIX, Linux, Windows, IBM i]On IBM MQ for Multiplatforms, you have two additional options for handling large messages up to the maximum message length of 100 MB:
  • Message segmentation, where each large messages is sent in several smaller chunks. Messages can be segmented by either the application or the queue manager.
  • Reference messages, where a pointer to the message is sent with instructions that tell the destination how to get the actual message.
For more information, see the links at the end of this topic.

Procedure

  1. Change one or both of the MaxMsgLength attributes.

    [UNIX, Linux, Windows, IBM i]On IBM MQ for Multiplatforms, set the queue attribute in the range 0 through 100 MB, and set the queue manager attribute in the range 32768 bytes through 100 MB.

    [z/OS]On IBM MQ for z/OS®, set the queue attribute in the range 0 through 100 MB. The MaxMsgLength queue manager attribute is hard coded at 100 MB.

  2. Restart your applications and channels to ensure that the changes take effect.

    After these changes are made, the message length must be less than or equal to both the queue and the queue manager MaxMsgLength attributes. However, preexisting messages can be longer.

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