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.
- Use segmented messages. (Messages can be segmented by either the application or the queue manager.)
- 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.
On all platforms, you can set the queue attribute value in the range 0 through 100 MB.
After changing one or both of the MaxMsgLength attributes, restart your 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.
- Uniformity among queue managers is reduced. The maximum size of message data is determined by the
MaxMsgLengthfor 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 should be 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.