I think you may want to go read Sun's JMS tutorial http://java.sun.com/products/jms/tutorial/
Every session as per the JMS spec has its own thread, but every session can have multiple consumers listening to different destinations. So there should be no need to create 300 sessions. Just create a consumer for each destination using a single session and only create a new session if you require that some be transactional or use client ack instead of auto ack etc. Regards Tim. On Tue, 2008-02-19 at 12:25 -0800, Ben Chobot wrote: > Hey everybody. I'm playing around with the CMS client for ActiveMQ 5, > and I'm having some threading issues. It seems that every time I start a > session, I get a new thread to handle that session. Clearly, this won't > scale to lots of sessions, and in fact my OS won't let me create more > than 300 threads. I'm wondering if there's any way to get around this? > Can a single session asynchronously listen to more than one destination? > Even better, it looks like the CMS client has code for thread pools in > it, but C++ isn't my strong suite and it's not clear to me how I would > use it.... > > Any suggestions? > > > (As an aside, we're trying to figure out how reasonable it will be to > have a single client listen to 10,000 mostly-inactive queues, probably > mostly on separate brokers. Is that just flat-out not going to happen?)