The body of a message contains application data. However, a message
can have no body, and comprise only the header fields and properties.
XMS supports
five types of message body:
- Bytes
- The body contains a stream of bytes. A message with this type of body
is called a bytes message. The BytesMessage class for C or C++ and
IBytesMessage interface for .NET contain
the methods to process the body of a bytes message.
- Map
- The body contains a set of name-value pairs, where each value has an associated
data type. A message with this type of body is called a map message.
The MapMessage class for C or C++ and IMapMessage interface for .NET contain
the methods to process the body of a map message.
- Object
- The body contains a serialized Java or .NET object.
A message with this type of body is called an object message. The ObjectMessage
class for C or C++ and IObjectMessage interface for .NET contain
the methods to process the body of an object message.
- Stream
- The body contains a stream of values, where each value has an associated
data type. A message with this type of body is called a stream message.
The StreamMessage class for C or C++ and IStreamMessage interface for .NET contain the methods
to process the body of a stream message.
- Text
- The body contains a string. A message with this type of body is called
a text message. The TextMessage class for C or C++ and ITextMessage
interface for .NET contain
the methods to process the body of a text message.
In the C interface, XMS returns
a message handle to an application when the application creates a message.
The application can use this handle to call any of the methods of the Message
class and any of the methods of the BytesMessage, MapMessage, ObjectMessage,
StreamMessage, or TextMessage class, whichever is appropriate for the type
of message body. However, if an application tries to call a method that is
inappropriate for the type of message body, the call fails and XMS returns
an error.
A C application can call the
xmsMsgGetTypeId() function
to determine the body type of a message. The function returns one of the following
values:
- XMS_MESSAGE_TYPE_BASE
- If the message has no body
- XMS_MESSAGE_TYPE_BYTES
- If the message is a bytes message
- XMS_MESSAGE_TYPE_MAP
- If the message is a map message
- XMS_MESSAGE_TYPE_OBJECT
- If the message is an object message
- XMS_MESSAGE_TYPE_STREAM
- If the message is a stream message
- XMS_MESSAGE_TYPE_TEXT
- If the message is a text message
In the C++ interface, BytesMessage, MapMessage, ObjectMessage,
StreamMessage, and TextMessage are subclasses of the Message class.
In .NET, the IMessage interface
is the parent of all message objects and can be used in messaging functions
to represent any of the XMS message
types.
For information about the size and maximum and minimum values
of each of these data types, see Table 1.
For more information about the required data types
for elements of application data written in the body of a message
and about the five types of body message, see the subtopics.