Message groups
Messages can occur within groups to allow ordering of messages.
Message groups allow multiple messages to be marked as related to one another, and a logical order to be applied to the group (see Logical and physical ordering). On Multiplatforms, message segmentation enables large messages to be broken up into smaller segments. We cannot use grouped or segmented messages when putting to a topic.
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. Note: 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. Figure 1 shows a group of logical messages: By opening a queue and specifying MQOO_BIND_ON_GROUP, you force all messages in a group that are sent to this queue to be sent to the same instance of the queue. For more information on the BIND_ON_GROUP option, see Handling message affinities.
- 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.
Use logical messages within a group to:
- Ensure ordering (if this is not guaranteed under the circumstances in which the message is transmitted).
- Allow applications to group 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 to bear any relationship to other messages in the group. Other fields in the MQMD are independent; some might be identical for all messages in the group whereas others might be different. For example, messages in a group can have different format names, CCSIDs, and encodings.
- 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, see Message segmentation.
An individual message is broken down into smaller messages called segments. 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 might belong to a group ( Figure 2 shows an example of messages within a group). A segment is logically part of a single message, so only the MsgId, Offset, and MsgFlags fields in the MQMD should differ between separate segments of the same message. If a segment fails to arrive, reason code MQRC_INCOMPLETE_GROUP or MQRC_INCOMPLETE_MSG is returned as appropriate.
Segmentation is not supported on IBM MQ for z/OS.
We cannot use segmented or grouped messages with Publish/Subscribe.
Parent topic: IBM MQ messagesRelated concepts
Related reference
Related information