JMS messages
JMS messages are composed of a header, properties, and a body. JMS defines five types of message body.
JMS messages are composed of the following parts:
- Header
- All messages support the same set of header fields. Header fields contain values that are used by both clients and providers to identify and route messages.
- Properties
- Each message contains a built-in facility to support application-defined property values. Properties provide an efficient mechanism to filter application-defined messages.
- Body
- JMS defines five types of message body that cover the majority of messaging styles currently in use:
- Stream
- A stream of Java primitive values. It is filled and read sequentially.
- Map
- A set of name-value pairs, where names are strings and values are Java primitive types. The entries can be accessed sequentially or randomly by name. The order of the entries is undefined.
- Text
- A message containing a java.lang.String.
- Object
- A message that contains a serializable Java object
- Bytes
- A stream of uninterpreted bytes. This message type is for literally encoding a body to match an existing message format.
The JMSCorrelationID header field is used to link one message with another. It typically links a reply message with its requesting message. JMSCorrelationID can hold a provider-specific message ID, an application-specific String, or a provider-native byte[] value.