LibraryToggle FramesPrintFeedback

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 =;
   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 Iterator to traverse the list of properties.


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

Comments powered by Disqus
loading table of contents...