Saturday, September 24, 2011

JMS Header Values, who sets what

JMS API defines headers for messages that are sent asynchronously to a message destination (Queue or Topic).

A Client that sends a message has the ability to select 3 values:

1. JMSCorrelationID

2. JMSReplyTo

3. JMSType


These 3 values have meaning to the receiver of the message, and may have pre-defined semantics.

These can be useful to Browse the messages, a QueueBrowser object can read and display messages that are sitting in the queue by reading its header messages. Note, that the API doesn’t support browsing topics. It is advisable to keep an internal xml database record of messages that are destined for a topic, and wrap the commit atomically using a 2 phased commit protocol.