In JMS, a message,
javax.jms.Message
, consists of a header, some properties, and a body. In the body, the actual payload of business data is located. As for most payloads, the less the data transferred, the less I/O will occur, which in turn infers increased throughput. Keeping a JMS message as small as possible puts less strain on both the network and the persistence layer of the JMS provider.
The following are the five types of messages available in JMS, each defining what the message body can contain:
javax.jms.MapMessage
: It holds a message constructed by a set of key-value pairs. The keys are String objects, and the values are Java primitive data types.javax.jms.StreamMessage
: It holds a stream of Java primitive data types.javax.jms.BytesMessage
: It holds a message constructed by uninterpreted bytes.