You mean, get it without consuming it right?
Use a QueueBrowser for that. It allows you to browse the queue without removing its content (see JMS spec)
Yes! I want to get the pending ones without consuming them...
As far as my understaning goes! QueueBrowser can only be used with Queues not Topics??? will take another look at the specs anyway...
Please explain if there is a way to use a queue browser for topics.....
Thanks and regards,
As far as I know, no
There are pending msg in a topic in those case :
- durable subcriber does exist for that topic. JBossMQ will wait such a connection to deliver pending messages
- message is being processed (i.e. sent to all subscribers). When it's sent, it's removed from the topic
So it's difficult to know what you mean by pending messages on a Topic. it depends of your configuration I guess.
Please provide more details
You are absolutely correct. I do have a durabel remote subscriber. which connects at certain times during the day. In this case all the messages published on a particular topic will be persisted untill they have been received by the remote subscriber.
For reconciliation sake! on the local side the application should be able to tell that out of all the messages published on a given topic how many have been delivered and how many are still waiting to be delivered.
I hope it explains...
Thanks and regards,
Yeah it does explain a lot actually. Well as far as I know there is no mechanism for doing that but a crappy one.
You can SQL the JMS_MESSAGES table on the destination if you have only one subscriber. The number returned will be the message for that topic which have not been delivered so far.
Do not forget that message can be cached but if persistence is enabled, there are most probably on DB as well.
This solution is not elegant at all but it might be a start
select count(*) from jms_messages where destination = 'TOPIC.yourTopic';
If your Persistence Manager is JDBC of course :)
You can use the the Topic JMX MBean Operation getMessageCounter() that will give you a detailed state list of all topic internal queues including current queue depth (= no of pending msg). Have a look at the jmx-console / jboss.mq.destinations.
This should also work with all PersistenceManagers, not only the JDBC2 PM.
This sounds interesting.... will start working on it.. sounds like a more reliable and easy way... Other wise I was still struggling with JDBC2 and Hypersonic...