LibraryLink ToToggle FramesPrintFeedback

Inspecting the Message Header Properties

Table 20.3 lists the standard properties in the JMS header that you can inspect.


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 previously
1System.out.println("Correlation ID: "+messageHdr.getJMSCorrelationID());
2System.out.println("Message Priority: "+messageHdr.getJMSPriority());
3System.out.println("Redelivered: "+messageHdr.getRedelivered());
  
JMSPropertyType prop = null;
4List<JMSPropertyType> optProps = messageHdr.getProperty();
5Iterator<JMSPropertyType> iter = optProps.iterator();
6while (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:

1

Prints the value of the message's correlation ID.

2

Prints the value of the message's priority property.

3

Prints the value of the message's redelivered property.

4

Gets the list of the message's optional header properties.

5

Gets an Iterator to traverse the list of properties.

6

Iterates through the list of optional properties and prints their name and value.