A message property consists of a name string and an associated value, which must be either a string or one of the standard Java primitive data types (int, byte, short, long, float, double, or boolean). The Message interface provides methods for setting properties of each type (see Table 2–6). There is also a setObjectProperty method that accepts a primitive value in objectified form, as a Java object of class Integer, Byte, Short, Long, Float , Double, Boolean, or String . The clearProperties method deletes all properties associated with a message; the message header and body are not affected.
Table 2–6 Message Property Specification Methods
Name |
Description |
---|---|
Set integer property |
|
Set byte property |
|
Set short integer property |
|
Set long integer property |
|
Set floating-point property |
|
Set double-precision property |
|
Set boolean property |
|
Set string property |
|
Set property from object |
|
Clear properties |
The JMS specification defines certain standard properties, listed in Table 2–7 . By convention, the names of all such standard properties begin with the letters JMSX; names of this form are reserved and must not be used by a client application for its own custom message properties. Similarly, property names beginning with JMS_SUN are reserved for provider-specific properties defined by Message Queue itself; these are discussed in Chapter 3, Message Queue Clients: Design and Features
Table 2–7 Standard JMS Message Properties
Name |
Description |
---|---|
Identity of user sending message |
|
Identity of application sending message |
|
Number of delivery attempts |
|
Identity of message group to which this message belongs |
|
Sequence number within message group |
|
Identifier of transaction within which message was produced |
|
Identifier of transaction within which message was consumed |
|
Time message delivered to consumer |
|
Message state (waiting, ready, expired, or retained) |