Application segmentation
Application segmentation is used when queue-manager segmentation is not adequate, or when applications require data conversion with specific segment boundaries.
- Queue-manager segmentation alone is not adequate because the message is too large to be handled in a single buffer by the applications.
- Data conversion must be performed by sender channels, and the format is such that the putting application must stipulate where the segment boundaries are to be in order for conversion of an individual segment to be possible.
PMO.Options = MQPMO_LOGICAL_ORDER | MQPMO_SYNCPOINT
MQPUT MD.MsgFlags = MQMF_SEGMENT
MQPUT MD.MsgFlags = MQMF_SEGMENT
MQPUT MD.MsgFlags = MQMF_SEGMENT
MQPUT MD.MsgFlags = MQMF_LAST_SEGMENT
MQCMIT
If you do not use MQPMO_LOGICAL_ORDER, the application must set the Offset
and the length of each segment. In this case, logical state is not maintained automatically.
The getting application cannot guarantee to have a buffer large enough to hold any reassembled message. It must therefore be prepared to process segments individually.
For messages that are segmented, this application does not want to start processing one segment until all the segments that constitute the logical message are present. MQGMO_ALL_SEGMENTS_AVAILABLE is therefore specified for the first segment. If you specify MQGMO_LOGICAL_ORDER and there is a current logical message, MQGMO_ALL_SEGMENTS_AVAILABLE is ignored.
After the first segment of a logical message has been retrieved, use MQGMO_LOGICAL_ORDER to ensure that the remaining segments of the logical message are retrieved in order.
GMO.Options = MQGMO_SYNCPOINT | MQGMO_LOGICAL_ORDER
| MQGMO_ALL_SEGMENTS_AVAILABLE | MQGMO_WAIT
do while ( SegmentStatus == MQSS_SEGMENT )
MQGET
/* Process each remaining segment of the logical message */
...
MQCMIT