5 Replies Latest reply on Apr 4, 2007 3:10 AM by Prasanna

    Monitoring the depth of a Queue/Topic

    Michael Bauer Newbie

      As part of a self-impossed excersise to better understand JMS, Spring, JBoss, and how it all fits together, I am writing a little web service that generated hashes off all possible permutations of a string. The way I have things organized currently are as follows:
      1) DAO/VO layer done as a Library that encapulates the generated hashes
      2) Utility layer, deployed as part of the WAR (to be mentioned next) that has a Queue consumer and a Queue producer. The producer is an MBean with a thread that generated possible text permutations, then deposits them into the Queue as a TextMessage. The consumer gets these TextMessages and uses the text to generate the Hashes, create the VOs, and store them into the DB using the DAOs
      3) A WAR thats actually empty, but will eventually be my first Attempt at a real GWT application. Currently its only used to bootstrap Spring and the JBossMQ queue

      As I said, all of this is wired via Spring, and for the JMS Producer I am using the JmsTemplate to send messages.

      My delima now is this. I would like to have the message producer monitor the queue depth in a thread and add messages as it falls below some threashold, sort of like a throttle. Unfortunately, I can't for the life of me figure out how to do this. From the Spring-side, I have access to the JmsTemplate, which means I can get a JMS Connection object or the JMS Destination object. Neither of which seems to have any methods that indicate Queue depth.

      Does anyone out there know where I can start looking? Is there not a generic JMS way to do this? Should I instead start looking to a more JBoss-specific method?

      I was attempting to make this App Server agnostic, but its not really a requirement since I am using JBoss anyway.