• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it possible to create a listener for JMS's QueueBrowser?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im at a loss here. How does one go about creating a listener for the QueueBrowser?

It has no .setMessageListener() method so I cant just use a MessageListener.

Do i have to create my own version of the QueueBrowser by implementing QueueBrowser and QueueReceiver interfaces in one class?

Is there a better way?

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!
 
author
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

thanks,

Rob Davies
CTO
http://fusesource.com
 
Ranch Hand
Posts: 81
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic