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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access