JMS messages have a defined structure that includes headers and payloads.
The following figure depicts the JMS message structure:
Header
A header must be present in every JMS message, and it is assigned automatically. Most of the values in the header are set by the JMS provider when the message is put to a JMS destination. Some values can be declared by the JMS client when it creates a JMS session, or when it creates the message consumer or producer; for example, JMSDeliveryMode, JMSExpiration, JMSReplyTo, and JMSCorrelationID are created when the JMS client creates a JMS session or creates the message consumer or producer.
The data elements of each header comprise name-value pairs and they can be any of the Java™ following types: Boolean, byte, short, char, long, int, float, double, string, or byte[].
Properties
The properties are optional, and can be divided into the following subsections:
A Java application can assign application-related properties, which are set before the message is delivered. The property names of the application are meaningful only to the sending and receiving applications.
Every JMS provider can define proprietary properties that can be set either by the client or automatically by the provider. Provider-related properties are prefixed with JMS_ followed by the vendor name and the specific property name. For example, the WebSphere® MQ JMS client sets the provider property to be JMS_IBM_MsgType.
These properties are set by the JMS provider when a message is sent. The JMS provider vendor can choose to not support any standard properties, to support some standard properties, or to support all standard properties. Standard property names start with JMSX; for example: JMSXUserid or JMSXDeliveryCount.
The properties are handled as name-value pairs, and they can be any of the following Java types: Boolean, byte, short, char, long, int, float, double, string, or byte[].
Payload
The payload type defines the JMS message. It can be one of the six JMS message types that are described in JMS message types.
JMS does not define a wire format. The Java Message Service Specification, version 1.1 describes the physical representation of how a message is structured.