activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zizou77 <pa...@laposte.net>
Subject QueueBrowser acknowledge
Date Thu, 23 Nov 2006 09:10:57 GMT

Hi,

I use a queueBrowser with a selector in my program. So I get some Message.
But when I use message's acknowledge method, messages are still in the
queue. Why?
I use Session.CLIENT_ACKNOWLEDGE, but i've got the same problem with
Session.AUTO_ACKNOWLEDGE.

This a part of my program:

 public void run() {
        ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory(broker);

        try {
            QueueConnection connexion = factory.createQueueConnection();
            connexion.start();
            QueueSession session = connexion.createQueueSession(false,
Session.CLIENT_ACKNOWLEDGE);
            Queue groupMsgQueueReceiver = session.createQueue(queueIn);
            QueueReceiver queueReceiver =
session.createReceiver(groupMsgQueueReceiver);
            Queue groupMsgQueueSender = session.createQueue(queueOut);
            QueueSender queueSender =
session.createSender(groupMsgQueueSender);
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }

//lookForGroupDocuments is a method started by a job scheduler quartz
 private void lookForGroupDocuments()
    {

      QueueBrowser queueBrowser = session.createBrowser(queue, selector);
      Enumeration enumeration;
      List<Message> messageDocumentsList = new ArrayList();
      enumeration = queueBrowser.getEnumeration();
      while (enumeration.hasMoreElements()) {
            Message message = (Message) enumeration.nextElement();
            messageDocumentsList.add(message);
       }
          
........

then i do:

for (int i = 0; i < messageDocumentsList.size(); i++) {
       messageDocumentsList.get(i).acknowledge();
}

-- 
View this message in context: http://www.nabble.com/QueueBrowser-acknowledge-tf2689843.html#a7500849
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message