Message groups

 


Messages can occur within groups. This allows ordering of messages (see Logical and physical ordering), and, except on WebSphere MQ for z/OS, segmentation of large messages (see Message segmentation) within the same group.

The hierarchy within a group is as follows:

Group
This is the highest level in the hierarchy and is identified by a GroupId. It consists of one or more messages that contain the same GroupId. These messages can be stored anywhere on the queue.

The term "message" is used here to denote one item on a queue, such as would be returned by a single MQGET that does not specify MQGMO_COMPLETE_MSG.

Logical message
Logical messages within a group are identified by the GroupId and MsgSeqNumber fields. The MsgSeqNumber starts at 1 for the first message within a group, and if a message is not in a group, the value of the field is 1.

Logical messages within a group can be used to:

  • Ensure ordering (if this is not guaranteed under the circumstances in which the message is transmitted).

  • Allow applications to group together similar messages (for example, those that must all be processed by the same server instance).

Each message within a group consists of one physical message, unless it is split into segments. Each message is logically a separate message, and only the GroupId and MsgSeqNumber fields in the MQMD need bear any relationship to other messages in the group. Other fields in the MQMD are independent; some may be identical for all messages in the group whereas others may be different. For example, messages in a group may have different format names, CCSIDs, encodings, and so on.

Segment
Segments are used to handle messages that are too large for either the putting or getting application or the queue manager (including intervening queue managers through which the message passes). For more information about this, see Message segmentation.

A segment of a message is identified by the GroupId, MsgSeqNumber, and Offset fields. The Offset field starts at zero for the first segment within a message.

Each segment consists of one physical message that may or may not belong to a group (Figure 4 shows an example of messages within a group). A segment is logically part of a single message, so only the MsgId, Offset, and SegmentFlag fields in the MQMD should differ between separate segments of the same message.

For a description of logical and physical messages, see Logical and physical ordering. For further information about segmenting messages, see Message segmentation.

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.