Application segmentation
Application segmentation is used for two main reasons:
- 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 needs to stipulate where the segment boundaries are to be in order for conversion of an individual segment to be possible.
However, if data conversion is not an issue, or if the getting application always uses MQGMO_COMPLETE_MSG, queue-manager segmentation can also be allowed by specifying MQMF_SEGMENTATION_ALLOWED. In our example, the application segments the message into four segments:
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 MQCMITIf 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.
Once 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.
No consideration is given to messages within different groups. If such messages occur, they are processed in the order in which the first segment of each message appears on the queue.
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
Parent topic:
Message segmentation
fg12710_