You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by bobsponge <ru...@tecnicasdeingenieria.com> on 2008/04/28 16:46:43 UTC

Problem with enumeration in queue browsing

Hello. 
I'm using a browser for getting messages stored in a queue without removing
them. The queue is filled with more than 12000 elements and I want to access
to single messages one by one. The main part of the method I use for getting
messages looks like this one:

if((queueContent= browser.getEnumeration())!=null){           
targetSize=0; 
            while(queueContent.hasMoreElements() && !msgFound) {
               if((qDequeuedMsg = (Message)
queueContent.nextElement())!=null){

                  if(targetSize==pIndex){
                     objectMsg = ( ObjectMessage ) qDequeuedMsg;
                     qMsg= (QueueMessage) objectMsg.getObject();
                     msgFound=true;
                  }

                  targetSize++;
               }
}

>From a different part of my application I call this method for getting
messages from the queue as long as they're needed. 
The first 156 times it works ok, but the next time this method is called and
the enumeration is built no more than 67 messages are listed. Every time I
run my application it always happens the same problem.
I'm ussing ActiveMQ 4.1.1. 
Is there any problem in listing messages this way?

Thank you


-- 
View this message in context: http://www.nabble.com/Problem-with-enumeration-in-queue-browsing-tp16940552s2354p16940552.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.