activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankit Vernekar <ankit.s.verne...@gmail.com>
Subject Re: Message not removed from queue
Date Wed, 13 May 2009 03:50:21 GMT

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.


Mime
View raw message