activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From avin98 <avi...@yahoo.com>
Subject RE: ActiveMQ memory utilization
Date Fri, 16 Feb 2007 02:15:09 GMT

Sure thing, thats what I do. But I find that if the messages don't get
consumed:

1- They don't expire in spite of setting a TimeToLive 
2- Consume more memory and slow up the other operations.

I am using AMQ v 3.2.4 bundled inside WASCE 1.1




Suchitha Koneru (sukoneru) wrote:
> 
> On the Receiver side , make sure that  you start the queue connection ,
> after you  create the active MQ receiver . Some times the messages might
> be lost , if we start the queue connection , before creating the
> receiver.
> 
> -----Original Message-----
> From: avin98 [mailto:avin98@yahoo.com] 
> Sent: Thursday, February 15, 2007 5:39 PM
> To: users@activemq.apache.org
> Subject: RE: ActiveMQ memory utilization
> 
> 
> import java.io.IOException;
> import java.util.Date;
> 
> import javax.jms.DeliveryMode;
> import javax.jms.JMSException;
> import javax.jms.Queue;
> import javax.jms.QueueConnection;
> import javax.jms.QueueSender;
> import javax.jms.QueueSession;
> import javax.jms.Session;
> import javax.jms.TextMessage;
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> 
> 
> public class TestServlet extends HttpServlet{
> 	
> 	public void doGet(HttpServletRequest request,
> HttpServletResponse response)
>     throws IOException, ServletException {
> 		doPost(request, response);
> 	}
> 	
> 	public void doPost(HttpServletRequest request,
> HttpServletResponse
> response)
>     throws IOException, ServletException {
> 		
> 		String ttl = request.getParameter("TTL");
>         String oper = request.getParameter("OPER");
>         
> //      Get the JMS Service Locator
>         QueueLocator locator = QueueLocator.getInstance();
> 
>         QueueSender sender = null;
>         QueueSession publishSession = null;
>         QueueConnection connection = null;
>         
>         String str = "MESSAGE BODY";
> 
>         try {
> 
>             // create jms session
>             boolean transacted = false;
>             connection = (QueueConnection)
> QueueLocator.getInstance().getConnectionFactory().createConnection();
>             
>             publishSession =
> connection.createQueueSession(transacted,Session.AUTO_ACKNOWLEDGE);
>             
>             
>             
>             // Get the JMS Queue
>             Queue queue;
> 
>             queue = locator.getMessageQueue();
> 
>             System.out.println("Queue is:" + queue);
>             
>             // Get a Queue Sender
>             sender = publishSession.createSender(queue);
>             // The Messages are set to be temporary
>             sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
> 
>             TextMessage message = publishSession.createTextMessage();
>             message.setText(str);
>             //message.setJMSCorrelationID(corelationId);
> 
>             sender.setTimeToLive(300000);
> 
>             System.out.println("Message properties:"+
> message.getJMSExpiration());
>             System.out.println(new Date(sender.getTimeToLive()));
>             
>             sender.send(message);
> 
>             // log the stuff
>             System.out.println("Message sent off successfully");
> 
>         } catch (JMSException e) {
>             e.printStackTrace();
>         } finally {
>         	try{
>         		sender.close();
>         		publishSession.close();
>         		connection.close();
>             } catch(Exception e){
>         		e.printStackTrace();
>         	}
>         }
> 
> 	}
> }
> 
> --
> View this message in context:
> http://www.nabble.com/ActiveMQ-memory-utilization-tf3237215s2354.html#a8
> 997556
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-memory-utilization-tf3237215s2354.html#a8997890
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message