Application segmentation of logical messages
The messages must be maintained in logical order in a group, and some or all of them might be so large that they require application segmentation.
In our example, a group of four logical messages is to be put. All but the third message are large, and require segmentation, which is performed by the putting application:PMO.Options = MQPMO_LOGICAL_ORDER | MQPMO_SYNCPOINT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_LAST_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_LAST_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP MQPUT MD.MsgFlags = MQMF_LAST_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_LAST_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_LAST_MSG_IN_GROUP | MQMF_LAST_SEGMENT MQCMITIn the getting application, MQGMO_ALL_MSGS_AVAILABLE is specified on the first MQGET. This means that no messages or segments of a group are retrieved until the entire group is available. When the first physical message of a group has been retrieved, MQGMO_LOGICAL_ORDER is used to ensure that the segments and messages of the group are retrieved in order:
GMO.Options = MQGMO_SYNCPOINT | MQGMO_LOGICAL_ORDER | MQGMO_ALL_MSGS_AVAILABLE | MQGMO_WAIT do while ( (GroupStatus != MQGS_LAST_MSG_IN_GROUP) || (SegmentStatus != MQGS_LAST_SEGMENT) ) MQGET /* Process a segment or complete logical message. Use the GroupStatus and SegmentStatus information to see what has been returned */ ... MQCMITNote: If you specify MQGMO_LOGICAL_ORDER and there is a current group, MQGMO_ALL_MSGS_AVAILABLE is ignored. Parent topic: Message segmentation