Hi Ankit,

In your original code you create a transacted session, therefore the AUTO_ACKNOWLEDGE
is kind of ignored.

If you create the session with
                session=con.createSession(false, Session.AUTO_ACKNOWLEDGE);
it should work.


Best regards
Andreas


On May 13, 2009, at 5:50 AM, Ankit Vernekar wrote:


HI Bryan,
            The original implementation is as follows
public void start()
        {
                System.out.println("Inside start.");
                try
                {
                conFac=new ActiveMQConnectionFactory();
                con=conFac.createConnection();          
                session=con.createSession(true, Session.AUTO_ACKNOWLEDGE);
                Destination destination = new ActiveMQQueue("PaymentsXML");
                con.start();
                consumer=session.createConsumer(destination);
                consumer.setMessageListener(this);
                System.out.println("start ended");            
                }
                catch(Exception e)
                {
                        System.out.println(e.getMessage());
                }
        }

public void onMessage(Message msg)
        {
                System.out.println("On Message on");
                try {
                        TextMessage tmsg=(TextMessage)msg;
                        String output=tmsg.getText();
                        Transformer t=new Transformer();
                        String result=t.XMLtoXML(output);
                        System.out.println("-----Output-----");
                        System.out.println(result);
                        System.out.println("-----xxxxxx-----");
                        PrintWriter pr=new PrintWriter("C:\\Documents and
Settings\\PMC\\Desktop\\output.xml");
                        pr.write(result);
                        pr.close();                     
                
                } catch (Exception e) {
                        System.out.println(e.getMessage());
                }
}

The class containing these methods implements Service,MessageListener hence
start method is used
Even though i am able to read the message from the activemq queue the
message does not get deleted
Can you please point where I may be going wrong and any solution for that.

Thank you,
Ankit Vernekar

--
View this message in context: 
http://www.nabble.com/Message-not-removed-from-queue-tp23496850p23514931.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Reply via email to