The messages consist of a header, properties, and a body. The header has a fixed structure with standard fields:
A unique message identifier is stored in the JMSMessageID
fields by the middleware. The sender can relate a message to another message by filling the JMSCorrelationID
field.
The destination address is stored in the JMSDestination
field by the middleware.
The sender can specify a destination address of an expected reply by filling the JMSReplyTo
field.
The JMSType
field specifies the message type, understood only by the sender and the recipient.
The middleware fills the JMSTimestamp
field with the send timestamp.
The JMSDeliveryTime
field provides the earliest delivery time,
computed from the send timestamp and the minimum message delivery delay.
The JMSExpiration
field provides the expiration timestamp,
computed from the send timestamp and the message lifetime.
The JMSPriority
field specifies message priority.
The JMSDeliveryMode
filed determines whether the message is persistent.
The middleware indicates repeated delivery, due to session recovery,
using the JMSRedelivered
field. The delivery
count is reported in an associated property (JMS 2.0 and above).
Message properties are in fact optional message header fields. Properties are stored as name-value pairs with typed access interface. The standard reserves a unique name prefix for certain typical properties. These include for example user and application identity or current transaction context.
Messages can be filtered based on the value of message properties. The filters are specified using simple conditional expressions called message selectors.
The message body takes one of five shapes derived from the message type, namely BytesMessage
, MapMessage
, ObjectMessage
, StreamMessage
, TextMessage
.