| <div class="wiki-content maincontent"> |
| <p>If you want to consume messages in a different order, or consume specific messages at the head, middle or tail of the queue, you can</p> |
| |
| <ul><li>browse the messages using the QueueBrowser to find the JMSMessageID's of the messages you want to consume</li><li>create a new consumer with a selector matching the ID(s) you want.</li></ul> |
| |
| |
| <p>e.g. here is an example selector</p> |
| |
| <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> |
| <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ |
| JMSMessageID = 'abc' |
| ]]></script> |
| </div></div> |
| |
| <p>Note that this is not a very efficient way of working with JMS (JMS is designed for consumers to be long lived objects working across many messageS), but it can be useful in certain situations.</p> |
| |
| <p>Another option is just to use <a shape="rect" href="jmx.xml">JMX</a> directly to browse messages on a queue, process them and then delete them.</p></div> |
| |