The body of a message contains application data. However, a message can have no body, and comprise only the header fields and properties.
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 error code XMS_E_BAD_PARAMETER.
xmsMESSAGE_TYPE msgtype; xmsMsgConsumerReceive(messageConsumer, &msg, errorBlock); xmsMsgGetTypeId(msg, &msgtype, errorBlock); if (msgtype == XMS_MESSAGE_TYPE_BYTES) { xmsBytesMsgGetBodyLength(msg, &length, errorBlock); }
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.
To ensure that XMS applications can exchange messages with WebSphere MQ JMS applications, an XMS application and a WebSphere MQ JMS application must be able to interpret the application data in the body of a message in the same way. For this reason, each element of application data written in the body of a message by an XMS application must have one of the data types listed in Table 1. For each XMS data type, the table shows the compatible Java data type. XMS provides the methods to write elements of application data with these data types, and only these data types.
XMS data type | Represents | Size | Compatible Java data type |
---|---|---|---|
xmsBOOL | The boolean value xmsTRUE or xmsFALSE | 32 bits | boolean |
xmsCHAR16 | Double byte character | 16 bits | char |
xmsSBYTE | Signed 8-bit integer | 8 bits | byte |
xmsSHORT | Signed 16-bit integer | 16 bits | short |
xmsINT | Signed 32-bit integer | 32 bits | int |
xmsLONG | Signed 64-bit integer | 64 bits | long |
xmsFLOAT | Signed floating point number | 32 bits | float |
xmsDOUBLE | Signed double precision floating point number | 64 bits | double |
String | String of characters | - | String |
For more information about the five types of body message, see the following topics: