Sun Java System Message Queue 3.7 UR1 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 

Description 

JMSDestination

Specifies the name of the destination object to which the message is sent. (Set by the provider.)

JMSDeliveryMode

Specifies whether the message is persistent. (Set by default by the provider or explicitly by the client for a producer or for an individual message.)

JMSExpiration

Specifies the time when the message will expire. (Set by default by the provider or by the client for a producer or for an individual message.)

JMSPriority

Specifies the priority of the message within a 0 (low) to 9 (high) range. (Set by default by the provider or set explicitly by the client for a producer or for an individual message.)

JMSMessageID

Specifies a unique ID for the message within the context of a provider installation. (Set by the provider.)

JMSTimestamp

Specifies the time when the provider received the message. (Set by the provider.)

JMSCorrelationID

A value that allows a client to define a correspondence between two messages. (Set by the client if needed.)

JMSReplyTo

Specifies a destination where the consumer should send a reply. (Set by the client if needed.)

JMSType

A value that can be evaluated by a message selector. (Set by the client if needed.)

JMSRedelivered

Specifies whether the message has already been delivered but not acknowledged. (Set by the provider.)

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 provider (either the broker or the 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.

The header fields (JMSDeliveryMode, JMSExpiration, and JMSPriority) can be set at three different levels:

If these fields are set at more than one level, values set for the connection factory override those set for the individual message; values set for a given message override those set for the message’s producer.

Constant names for message header fields vary with the language implementation. See Sun Java System Message Queue 3.7 UR1 Developer’s Guide for Java Clients or Sun Java System Message Queue 3.7 UR1 Developer’s Guide for C Clients for more information.