You haven't show all the applicable code.  You've selected a "client
acknowledge" session, but you don't show the code where you are
actually receiving the message.  Are you acknowledging the message
once you've received it?

Also, why are you committing the session here?  If you want to use
transactions, you should create a transactional session, not a client
acknowledge session and you should commit/rollback the session once
you've received and handled the message.  I just don't see the point
of committing the session in this particular snippet of code.

Bryan

On Tue, May 12, 2009 at 1:25 AM, Ankit Vernekar
<ankit.s.verne...@gmail.com> wrote:
>
> Hi,
> I am using the following code to read from the queue
> try
>                {
>                conFac=new ActiveMQConnectionFactory();
>                con=conFac.createConnection();
>                session=con.createSession(true, Session.CLIENT_ACKNOWLEDGE);
>                Destination destination = new ActiveMQQueue("PaymentsXML");
>                con.start();
>                consumer=session.createConsumer(destination);
>                consumer.setMessageListener(this);
>                System.out.println("start ended");
>                session.commit();
>                }
>                catch(Exception e)
>                {
>                        System.out.println(e.getMessage());
>                }
>
> the message is read but doesnt get deleted from the queue (i.e. queuesize
> doesnot get reduced).Please suggest a solution.
>
> Thank You,
> Ankit Vernekar
> --
> View this message in context: 
> http://www.nabble.com/Message-not-removed-from-queue-tp23496850p23496850.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Reply via email to