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

    How to handle a message queue?

    Thiago Bonfante Newbie

      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:

           publisher.send(message1);
           publisher.send(message2);
           publisher.send(message3);
           publisher.send(message4);
           publisher.send(message5);
      
      

       

      MDB is processing just one per time:

           onMessage(Message message){
      
                System.out.println("Message " + message + " received");
      
                try {
                     Thread.sleep(10000);
                } catch (InterruptedException e) {
                     e.printStackTrace();
                }          
      
                System.out.println("Done!");
      
           }
      

       

      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.