Sun Java System Message Queue 4.1 Technical Overview

Message Body

The message body contains the data that clients want to exchange.

The type of a JMS message determines what the body may contain and how it should be processed by the consumer, as specified in Table 2–4. The Session object includes a create method for each type of message body.

Table 2–4 Message Body Types

Type 

Description 

StreamMessage

A message whose body contains a stream of Java primitive values. It is filled and read sequentially. 

MapMessage

A message whose body contains a set of name-value pairs. The order of entries is not defined. 

TextMessage

A message whose body contains a Java string, for example an XML message. 

ObjectMessage

A message whose body contains a serialized Java object. 

BytesMessage

A message whose body contains a stream of uninterpreted bytes. 

Message

A message that contains a header and properties but no body. 

Java clients can set a property to have the client runtime compress the body of a message being sent. The Message Queue runtime on the consumer side decompresses the message before delivering it.