Appendix B. Message Headers
The message headers provide metadata describing who or what created the message, when it was created, how long its data is valid, etc. The headers also contain routing information that describes the destination of the message (topic or queue), how a message should be acknowledged, and a lot more.
The Message
interface provides
mutator (“set”) methods for each of the JMS headers, but only the JMSReplyTo
, JMSCorrelationID,
and JMSType
headers can be modified using these
methods. Calls to the mutator methods for any of the other JMS headers
will be ignored when the message is sent. According to the authors of the
specification, the mutator methods were left in the Message
interface for “general orthogonality”;
to balance the accessor methods—a fairly strange but well-established
justification.
The accessor (“get”) methods always provide the JMS client with
information about the JMS headers. However, some JMS headers (JMSTimestamp
, JMSRedelivered
, etc.) are not available until
after the message is sent or even received.
Get Java Message Service, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.