A JMS message header contains a number of predefined fields that contain values that both clients and providers use to identify and to route messages. Table 30–1 lists the JMS message header fields and indicates how their values are set. For example, every message has a unique identifier, which is represented in the header field JMSMessageID. The value of another header field, JMSDestination, represents the queue or the topic to which the message is sent. Other fields include a timestamp and a priority level.
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 30–1 How JMS Message Header Field Values Are Set
Header Field |
Set By |
---|---|
send or publish method |
|
send or publish method |
|
send or publish method |
|
send or publish method |
|
send or publish method |
|
send or publish method |
|
Client |
|
Client |
|
Client |
|
JMS provider |