7 Replies Latest reply on Apr 9, 2008 12:03 PM by adrian.brock

    QueueBrowser not returning anything in Enumerator

    tim.shaw

      The following is a code snippet which works without error, but does not return any details in the QueueBrowser, I cannot fathom out why this could be.
      A number of messages get placed on the queue, and if I stick a debug breakpoint within the onMessage process, I can see these persisted in the database, before process completion.
      If I use the JMX console, the queue shows the correct number of items to be processed but when executing the listAllMessages() method, this also returns an empty array.
      Any clues as to what might be the problem or areas to look at would be appreciated. Thanks

      InitialContext ctx = PropertiesHelper.getInitialContext();

      Queue queue = (Queue)ctx.lookup( "queue/calendarQueue" );

      QueueConnectionFactory connectionFactory = (QueueConnectionFactory)ctx.lookup( "java:/JmsXA" );

      QueueConnection connection = connectionFactory.createQueueConnection();

      Session session = connection.createQueueSession( true, QueueSession.AUTO_ACKNOWLEDGE );

      QueueBrowser queueBrowser = session.createBrowser( queue );

      Enumeration queueEnumerator = queueBrowser.getEnumeration();

      int number = Collections.list( queueEnumerator ).size();

        • 1. Re: QueueBrowser not returning anything in Enumerator

          QueueBrowsers don't show messages that have been delivered to clients.

          • 2. Re: QueueBrowser not returning anything in Enumerator
            tim.shaw

            Please could you expand on this and define "delivered" and "client". By delivered is this the point when it reaches the onMessage method or when the message is fully removed from the database?

            I stated in my text that by placing a breakpoint during processing within my IDE, the messages are 'visible' and it would be my understanding that these would be available to the QueueBrowser enumerator.

            Also, within the JMX console the message count is not 0 which implies to me that the messages have not been fully delivered, but they are not being shown in the message listings.

            Thanks for any further comment on this topic.

            • 3. Re: QueueBrowser not returning anything in Enumerator

              See listinProcessMessage() on the wiki

              • 4. Re: QueueBrowser not returning anything in Enumerator
                tim.shaw

                I presume you mean http://wiki.jboss.org/wiki/Wiki.jsp?page=JBMCantSeeMessages? Your suggestion for search returned nothing, so thanks for that.

                The issue is that, when using messaging to distribute processing across the cluster, we would like to know when all the messages have been processed - implementing a fork/join in process-management terms.

                I can understand that the queue is prefetched to the cluster members, and so the elements are unavailable to the QueueManager, and I can see that implementing the functionality required would involve querying each of the cluster members for it's state (in buffer, being handled etc), and that this may not be possible (or, rather, easy).

                However, I would suggest that this is not an unusual scenario (fork/join is a pretty basic mechanism) and think that others would have a strategy to deal with this ... and was wondering if there were any suggestions?

                All we are trying to do is solve a real world problem - a little less tersity would have been appreciated.

                I will post a separate thread to try to get useful comments on this ... and maybe set up a wiki page for it?

                tim

                • 5. Re: QueueBrowser not returning anything in Enumerator

                   

                  "dovetail" wrote:
                  I presume you mean http://wiki.jboss.org/wiki/Wiki.jsp?page=JBMCantSeeMessages? Your suggestion for search returned nothing, so thanks for that.


                  No. Because that is about JBoss Messaging while this is the JBossMQ forum.
                  I mean listInProcessMessages which is in the JBossMQ documentation.


                  All we are trying to do is solve a real world problem - a little less tersity would have been appreciated.


                  I'd be less terse if this wasn't an FAQ that still gets asked redundantly twice a month.
                  Of course you can't find the long version of the answer because redundant
                  questions like yours make the search unusable.
                  If you want to complain, then complain to yourself and people with the same
                  lazy attitude.

                  • 6. Re: QueueBrowser not returning anything in Enumerator
                    tim.shaw

                     

                    I mean listInProcessMessages which is in the JBossMQ documentation.

                    Sorry, when you said 'in the wiki' I presumed you meant 'in the wiki'. Obviously my mistake.
                    I'd be less terse if this wasn't an FAQ that still gets asked redundantly twice a month.

                    I suggest that if an FAQ continues to get asked, then the FAQ section is at fault. We finally found it by searching for 'InProcess' in the wiki. The actual title of the FAQ is 'There is always one more InProcess message than there should be' ... which is rather like expecting me to find it in a cupboard behind a door marked 'beware of the leopard'!
                    Of course you can't find the long version of the answer because redundant
                    questions like yours make the search unusable.

                    Just quoting a correct search term, a URL or even a terse message saying it was covered in the FAQ would have been sufficient - but judging from your previous posts your patience and tolerance levels are rather below what I would expect from a professional spokesperson.
                    If you want to complain, then complain to yourself and people with the same
                    lazy attitude.

                    That's just rude and unnecessary. I was politely (if slightly tongue-in-cheek) pointing out that you could have expended the same amount of effort giving a helpful answer.

                    I repeat my thanks from the earlier post.

                    Have a good day.

                    tim

                    • 7. Re: QueueBrowser not returning anything in Enumerator

                       

                      "tim.shaw" wrote:

                      I suggest that if an FAQ continues to get asked, then the FAQ section is at fault.


                      The FAQ is a WIKI. If you think it is wrong, misleading or hard to use,
                      you can fix it yourself. I've got no idea why you think it is wrong, you do.
                      I'm not psychic.


                      Just quoting a correct search term, a URL or even a terse message saying it was covered in the FAQ would have been sufficient - but judging from your previous posts your patience and tolerance levels


                      I have zero tolerance for people that pollute the search index with redundant
                      repeat questions especially when they then complain that they can't find anything.


                      are rather below what I would expect from a professional spokesperson.


                      At jboss.org I'm not an official spokesperson, I'm just another member
                      of the community answering questions for free.
                      I'm just one that posts LARTs to try to stop this forum
                      filling up with lazy/repeat questions making it impossible for other
                      members of the community to find where a question was actually answered.

                      Like I always say. If you want to be lazy use the newbies forum.