Table 20.3 lists the standard properties in the JMS header that you can inspect.
Table 20.3. JMS Header Properties
Property Name | Property Type | Getter Method |
---|---|---|
Correlation ID | string |
getJMSCorralationID()
|
Delivery Mode | int |
getJMSDeliveryMode()
|
Message Expiration | long |
getJMSExpiration()
|
Message ID | string |
getJMSMessageID()
|
Priority | int |
getJMSPriority()
|
Redelivered | boolean |
getJMSRedlivered()
|
Time Stamp | long |
getJMSTimeStamp()
|
Type | string |
getJMSType()
|
Time To Live | long | getTimeToLive() |
In addition, you can inspect any optional properties stored in the JMS header using JMSMessageHeadersType.getProperty()
. The optional properties are returned as a List
of org.apache.cxf.transports.jms.context.JMSPropertyType
. Optional properties are stored as name/value pairs.
Example 20.14 shows code for inspecting some of the JMS properties using the response context.
Example 20.14. Reading the JMS Header Properties
// JMSMessageHeadersType messageHdr retrieved previouslySystem.out.println("Correlation ID: "+messageHdr.getJMSCorrelationID());
System.out.println("Message Priority: "+messageHdr.getJMSPriority());
System.out.println("Redelivered: "+messageHdr.getRedelivered()); JMSPropertyType prop = null;
List<JMSPropertyType> optProps = messageHdr.getProperty();
Iterator<JMSPropertyType> iter = optProps.iterator();
while (iter.hasNext()) { prop = iter.next(); System.out.println("Property name: "+prop.getName()); System.out.println("Property value: "+prop.getValue()); }
The code in Example 20.14 does the following:
Prints the value of the message's correlation ID. | |
Prints the value of the message's priority property. | |
Prints the value of the message's redelivered property. | |
Gets the list of the message's optional header properties. | |
Gets an | |
Iterates through the list of optional properties and prints their name and value. |