Multipart messages

A multipart message contains one or more other messages within its structure. The contained message is sometimes referred to as an embedded message.

A multipart message must contain a group or a complex type with its Composition property set to Message. This group or complex type contains a list of references to messages which can appear at that location in the message structure. When a message is parsed, only one of the messages listed under the group or complex type can appear in that position in the message.

Message envelopes

A common use of multipart messages is to define an outer message with a fixed structure. This outer message is called the message envelope. Within the message envelope a group or complex type is included, as described above. Depending on the physical format being used, the message envelope can contain a special element which identifies the actual embedded message. This element is called the Message Key.

Identifying the embedded message

When a multipart message is parsed, the parser needs to be able to identify the embedded message (it could be any of the messages referenced by the group or complex type). Each physical format solves this problem in a different way, as described in the Multipart messages topic for each physical format.

Restrictions

Within a group or complex type which has Composition of Message, all of the embedded messages must come from the same message set as the group or type itself.

When a multipart message is received or generated by a broker, all embedded messages must be of the same physical format as the outermost message.