activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zizou77 <pa...@laposte.net>
Subject Re: QueueBrowser acknowledge
Date Fri, 24 Nov 2006 09:31:06 GMT

thanks,

I resolved my problem with this:

            Message receiverMsg;
            for (int i = 0; i < msgList.size(); i++) {
                // I delete messages that I select by queueBrowser
                receiverMsg =
groupMsgQueueManager.getQueueReceiver().receive();
                if
(receiverMsg.getJMSMessageID().equals(msgList.get(i).getJMSMessageID())){
                    receiverMsg.acknowledge();
                }
            }




Adrian Co wrote:
> 
> Hi,
> 
> I don't think you can remove a message from a queue using a queue 
> browser. You'd generally use a queue receiver for that.
> 
> zizou77 wrote:
>> 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#a7519967
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message