6 Replies Latest reply on Dec 20, 2010 7:21 AM by jacker

    How to handle a message queue?


      Hi folks. I'm trying to manipulate a jms queue. I have a MDB listening to, with this configuration:


      @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1")


      Now imagine this scenario:


      A client sending a lot of messages:



      MDB is processing just one per time:

           onMessage(Message message){
                System.out.println("Message " + message + " received");
                try {
                } catch (InterruptedException e) {


      Now the client need cancel the message3, because it was dispatched wrong. How can I do that without remove all of the queue?


      I've tried to delete it from JBM_MSG table, but it continues to being delivered. BTW I'm using JBoss 5.1.0 and default messaging service. Thanks.

        • 1. Re: How to handle a message queue?

          A simple way to do this is to use a QueueBrowser to check the queue, after you know the correct one you are able to consume it with a message selector for exact this message (e.g. the message id) or the client know the necessary message properties.

          • 2. Re: How to handle a message queue?

            Thanks for your answer Wolf. I'm trying that way but it has no messages in queue. I think it was already buffered, maybe I have to set consumer-window-size to zero, but i dunno where i set this parameter. What do you think?

            • 3. Re: How to handle a message queue?

              Just to complement, i tried to "Remove All Messages" by Admin-Console and JBoss failed to do that. It returns me:


              "removeAllMessages java.lang.IllegalStateException: Cannot remove references while deliveries are in progress (Channel 1), there are 5"

              • 4. Re: How to handle a message queue?

                I never tried AdminConsole for this.

                The application read via QueueBrowser it's own messages display it and the user is able to drop unprocessed messeges.

                This is done by a normal consuming with a special message selector.

                You never see messages which are in progress by the 'normal' processing

                • 5. Re: How to handle a message queue?

                  I've tried to implement de QueueBrowser but it seems doesn't work. My project example is on this link:





                  • 6. Re: How to handle a message queue?

                    I've found an answer for my question.


                    It is not possible to handle a message who's being delivered. I've tried to set the consumer window to zero, and a lot of other things. I've been studing a solution for case about a week, googling all possibilities but it cannot be done. Actually I've found the class who operate this channel between producer and consumer, but there a lot of comments sugesting to not alter the code to ensure integrity.