activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marlon Santos <msan...@exist.com>
Subject Re: QueueBrowser acknowledge
Date Thu, 23 Nov 2006 11:10:29 GMT


Hi, 
Based on your code, it seems that the queue that you use for the receiver is
different to the sender's queue. So they have different queues. And it seems
that you didnt actually sent a message, or an actual acknowledgement. Also,
are the queues still there when you use an actual consumer?


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#a7506647
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message