I need to be able to browse the contents of the queue without creating a block...(in other words, I would like the browse to occur asynchronously.)
Any help on this would be greatly appreciated, thanks all!
!!! RockStarArtist !!!
Joined: Nov 04, 2010
Unfortunately you can't create a MessageListener for a QueueBrowser. A QueueBrowser will show you the current state of the Queue - a snapshot of the current messages. You would periodically need to close the QueueBrowser and create a new one and filter out duplicates if you wanted to continuously monitor a Queue. Alternatively, most JMS messaging systems have their own custom API's for remotely monitoring the contents of the Queue, which are a better bet than using a QueueBrowser.
Queue Browser are meant just to check the queue at a point of time. Note that a queue browser represents a static snapshop of the queue. If more messages are added to the queue while browsing, this will not be available to the queue browser.
The order of messages returned by the enumeration reflects the order of messages a regular message receiver would see.
As per JMS API
A client uses a QueueBrowser object to look at messages on a queue without removing them.
The getEnumeration method returns a java.util.Enumeration that is used to scan the queue's messages. It may be an enumeration of the entire content of a queue, or it may contain only the messages matching a message selector.
Messages may be arriving and expiring while the scan is done. The JMS API does not require the content of an enumeration to be a static snapshot of queue content. Whether these changes are visible or not depends on the JMS provider.
There are queue monitors available with different JMS implementors like JBoss,Websphere etc which keeps on monitoring the queue continously.
SCJP SCWCD AIX SOA
The significant problems we face cannot be solved by the same level of thinking that created them -- Albert Einstein