On 28 Jan 2009, at 20:21, darrickc wrote:


I haven't been able to find anywhere the best practices for handling messages coming from ActiveMQ. When I receive a message via onMessage() I am in an ActiveMQ thread. Is it best to act on this message in non-ActiveMQ thread, or is it ok to do my work in the ActiveMQ thread? Will lengthy calculations
slow ActiveMQ if they are performed in the ActiveMQ thread that an
onMessage() gets called in? Currently I am doing both, for some things a spawn a worker thread to handle incoming messages, but sometimes I do quick
things in the ActiveMQ thread.

Thanks in advance!
--
View this message in context: 
http://www.nabble.com/Handling-messages-in-the-ActiveMQ-thread-best-practices--tp21713809p21713809.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Good question! - but there isn't a simple answer. It depends a lot on the rate of messages and the message type. ActiveMQ has a number of different strategies for ensuring that if you have a slow consumer (your taking a long time to process a message) - it won't blow your application memory. However, you may have already built in such strategies in your application (like overflowing to disk etc). If you haven't let ActiveMQ do the hard work for you ...

cheers,

Rob

Rob Davies
http://fusesource.com
http://rajdavies.blogspot.com/






Reply via email to