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

  • browse the messages using the QueueBrowser to find the JMSMessageID's of the messages you want to consume
  • create a new consumer with a selector matching the ID(s) you want.

e.g. here is an example selector

JMSMessageID = 'abc'

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.

Another option is just to use JMX directly to browse messages on a queue, process them and then delete them.

© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram