[UNIX, Linux, Windows, IBM i]

Segmentation and reassembly by queue manager

This is the simplest scenario, in which one application puts a message to be retrieved by another. The message might be large: not too large for either the putting or the getting application to handle in a single buffer, but too large for the queue manager or a queue on which the message is to be put.

The only changes necessary for these applications are for the putting application to authorize the queue manager to perform segmentation if necessary:

   PMO.Options = (existing options)
   MD.MsgFlags = MQMF_SEGMENTATION_ALLOWED
   MD.Version = MQMD_VERSION_2
   memcpy(MD.GroupId, MQGI_NONE, MQ_GROUP_ID_LENGTH)
MQPUT
and for the getting application to ask the queue manager to reassemble the message if it has been segmented:

   GMO.Options = MQGMO_COMPLETE_MSG | (existing options)
   MQGET

In this simplest scenario, the application must reset the GroupId field to MQGI_NONE before the MQPUT call, so that the queue manager can generate a unique group identifier for each message. If this is not done, unrelated messages can have the same group identifier, which might subsequently lead to incorrect processing.

The application buffer must be large enough to contain the reassembled message (unless you include the MQGMO_ACCEPT_TRUNCATED_MSG option).

If the MAXMSGLEN attribute of a queue is to be modified to accommodate message segmentation, then consider:
  • The minimum message segment supported on a local queue is 16 bytes.
  • For a transmission queue, MAXMSGLEN must also include the space required for headers. Consider using a value at least 4000 bytes larger than the maximum expected length of user data in any message segment that could be put on a transmission queue.

If data conversion is necessary, the getting application might have to do it by specifying MQGMO_CONVERT. This should be straightforward because the data conversion exit is presented with the complete message. Do not attempt to convert data in a sender channel if the message is segmented, and the format of the data is such that the data-conversion exit cannot carry out the conversion on incomplete data.