6 Replies Latest reply on Sep 29, 2010 11:24 AM by tomdzk

    How to look at scheduled messages in a queue

    tomdzk

      Hi,

       

      I'm trying to find a way to retrieve scheduled messages in a JMS queue by id (without consuming them). The two approaches I've tried so far, are:

       

      * QueueBrowser, e.g. session.createBrowser(queue, "JMSMessageID='ID:...")

       

      * Management API via JMS,  e.g. JMSManagementHelper.putOperationInvocation(request, "jms.queue.myQueue", "listMessages", "JMSMessageID='...'");

       

      Neither of these returns any scheduled messages, not even if I omit the selectors. Is there a way to retrieve scheduled messages from a queue other than manually filtering through the result of the listScheduledMessages operation ?

       

      cheers,

      Tom

        • 1. Re: How to look at scheduled messages in a queue
          timfox

          What's wrong with listScheduledMessages?

          • 2. Re: How to look at scheduled messages in a queue
            tomdzk

            The problem is that listScheduledMessages is cumbersome if there are a couple thousand or even hundreds of thousands of scheduled messages in the queue because filtering has to be done manually. If there were a version that accepts a normal (JMS or not) selector, that would make things a lot easier. And it would be nice if there was a way to get the body for a scheduled message (even if only by id).

            • 3. Re: How to look at scheduled messages in a queue
              timfox

              The problem is that scheduled messages are not in any particular order with respect to the other non scheduled messages in the queue. The ordering depends on the scheduled times for the messages and the time at which the non scheduled messages are consumed which is not known at the time of browse.

               

              If we were to provide the scheduled message in a browse where would be put the scheduled messages?

              • 4. Re: How to look at scheduled messages in a queue
                tomdzk

                Having to use the management interface to look at the scheduled messages would be fine with me (they are not part of the JMS spec anyways).

                But in order to manage hundreds of thousands of scheduled messages, I'd love if there was a way to query them by a message selector (similar to the removeMessages(filter) method), so that for instance I can 'tag' messages via properties and then select only those with a specific tag.

                • 5. Re: How to look at scheduled messages in a queue
                  timfox

                  That doesn't answer the question about what order they would appear in a browse with respect to non scheduled messages.

                  • 6. Re: How to look at scheduled messages in a queue
                    tomdzk

                    Well, if it would be a variation of listScheduledMessages that takes a filter, then that would only return scheduled messages, in pretty much the same order that listScheduledMessages right now returns the scheduled messages.