background image

Message Properties

<< JMS Message Selectors | JMS Queue Browsers >>
<< JMS Message Selectors | JMS Queue Browsers >>

Message Properties

Each header field has associated setter and getter methods, which are documented in the
description of the Message interface. Some header fields are intended to be set by a client, but
many are set automatically by the send or the publish method, which overrides any client-set
values.
TABLE 31­1
How JMS Message Header Field Values Are Set
Header Field
Set By
JMSDestination
send
or publish method
JMSDeliveryMode
send
or publish method
JMSExpiration
send
or publish method
JMSPriority
send
or publish method
JMSMessageID
send
or publish method
JMSTimestamp
send
or publish method
JMSCorrelationID
Client
JMSReplyTo
Client
JMSType
Client
JMSRedelivered
JMS provider
Message Properties
You can create and set properties for messages if you need values in addition to those provided
by the header fields. You can use properties to provide compatibility with other messaging
systems, or you can use them to create message selectors (see
"JMS Message Selectors" on
page 907
). For an example of setting a property to be used as a message selector, see
"A Java EE
Application That Uses the JMS API with a Session Bean" on page 964
.
The JMS API provides some predefined property names that a provider can support. The use
either of these predefined properties or of user-defined properties is optional.
Message Bodies
The JMS API defines five message body formats, also called message types, which allow you to
send and to receive data in many different forms and provide compatibility with existing
messaging formats.
Table 31­2
describes these message types.
The JMS API Programming Model
The Java EE 5 Tutorial · September 2007
908