FWIW there's no real need using a separate thread to create a consumer
in it if you are using the MessageListener (async) approach. You only
need to create separate threads if you are using the sync approach
(consumer.receive*() stuff).

Subscribing to messages lasts forever; so there is no explicit
graceful shutdown. Maybe expose an MBean so folks can explicitly close
things down - or listen to some queue/topic so folks can send your
process a message to close down gracefully?

On 3/5/07, LiXiao2007 <[EMAIL PROTECTED]> wrote:

I have a multi threaded program something like as follows.

main()
{
    create threads_1 to thread_n.
    create a connection to JMS queue
    for each thread
        thread_i.start();
}

// for each thread's run method
run()
{
   create session
   create consumer
   register the consumer with a message listener
}

My understanding is that as soon as run finishes, the thread is gone but the
jms run time creates another thread listening on onMessage(). My question is
how to exit the program gracefully. I would like to let each thread finishes
its job and exits by itsself.

Any help is greately appreciated.



--
View this message in context: 
http://www.nabble.com/How-to-stop-the-program-gracefully-tf3351123s2354.html#a9318656
Sent from the ActiveMQ - User mailing list archive at Nabble.com.




--

James
-------
http://radio.weblogs.com/0112098/

Reply via email to