Sun Java System Message Queue 4.3 Technical Overview

Message Header

A header is required of every JMS message. The header contains ten predefined fields, which are listed and described in Table 2–3.

Table 2–3 JMS-Defined Message Header

Header Field 


Set By 


Specifies the name of the destination to which the message is sent.

JMS provider 


Specifies whether the message is persistent.

Client, per producer or per individual message produced. 


Specifies the time when the message will expire.

Client, per producer or per individual message produced.. 


Specifies the priority of the message within a 0 (low) to 9 (high) range.

Client, per producer or per individual message produced. 


Specifies a unique ID for the message within the context of a JMS provider installation.

JMS provider 


Specifies whether the message has already been delivered but not acknowledged.

JMS provider 


Specifies the time when the JMS provider received the message.

JMS provider 


A value that allows a client to define a correspondence between two messages.

Client, if needed 


Specifies a destination where the consumer should send a reply.

Client, if needed 


A value that can be evaluated by a message selector.

Client, if needed 

As you can see from reading through this table, message header fields serve a variety of purposes: identifying a message, configuring the routing of messages, providing information about message handling, and so on.

One of the most important fields, JMSDeliveryMode, determines the reliability of message delivery. This field indicates whether a message is persistent.

Some message header fields are set by the JMS provider (the Message Queue broker and/or client runtime) and others are set by the client. Message producers may need to configure header values to obtain certain messaging behaviors; message consumers may need to read header values in order to understand how the message was routed and what further processing it might need.

Three of the header fields (JMSDeliveryMode, JMSExpiration, and JMSPriority) can be set at two different levels:

If these fields are set at more than one level, values set when producing a message override those set for the message’s producer.

Names of constant used for message header fields vary with the language implementation. See Sun Java System Message Queue 4.3 Developer’s Guide for Java Clients or Sun Java System Message Queue 4.3 Developer’s Guide for C Clients for more information.