Each queue uses up resources in the broker unless you use the JMX APIs
to delete queues from the broker.

2008/10/2 kneumei <[EMAIL PROTECTED]>:
>
> Hi,
> I am building an application in which I am using ActiveMQ to send messages
> to clients.  So far I have something like this.  The BrokerService and
> connectionFactory are created when my application starts up and are put into
> a singleton, and the connectionFactory is made available to other parts of
> the program:
>
>  BrokerService broker = new BrokerService();
>  broker.addConnector("tcp://localhost:61616");
>  broker.setPersistent(false);
>  broker.setUseJmx(false);
>  broker.start();
>  ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory();
>  connectionFactory.setBrokerURL("tcp://localhost:61616");
>
>
> When some part of my program wants to create a new queue, it creates a new
> MyMessageQueue object which has these two methods.  The start method is used
> to create a new queue, and the stop method is used to destroy it:
>
>
>        private Connection connection;
>        private Session session;
>        private Destination destination;
>        private MessageProducer messageProducer;
>        private String queueName;
>
>        public MessageQueueImpl(String queueName) {
>                this.queueName = queueName;
>        }
>
>        public void startMessageQueue(ConnectionFactory connectionFactory)
>                        throws JMSException {
>                connection = connectionFactory.createConnection();
>                connection.start();
>                session = connection.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>                destination = session.createQueue(queueName);
>                messageProducer = session.createProducer(destination);
>        }
>
>
>        public void stopMessageQueue() throws JMSException {
>                messageProducer.close();
>                session.close();
>                connection.stop();
>                connection.close();
>        }
>
>
> I have recently been profiling my application and noticed that after the
> stopMessageQueue() method is called, a thread called
> "QueueThread:queue://QUEUENAME"  has not died.  Am I doing something wrong
> when shutting down the queue?
>
> Thanks,
> Kyle
> --
> View this message in context: 
> http://www.nabble.com/How-to-properly-close-a-queue--tp19780281p19780281.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Reply via email to