I think this is another RFE but I might be wrong.. it would be nice to see this fixed in AMQ.
I have code that uses LOTS of ephemeral queues. It’s probably less than 1k total active queues at any one time, but if I don’t allow them to be GCd due to inactivity, it would EASILY grow and grow over months, overwhelming memory. I’m trying to implement code that closes the consumers on the backend , but there are races. If I close a consumer, a message could come in JUST after I close it, which would mean it NEVER gets processed. This would yield to data loss. However, if ActiveMQ GCd the queue when producers = 0 , and messages = 0, *regardless* of the number of consumers, then I thinks we’re golden. I can listen to advisory queue message telling me that the queue was closed, and then release my resources/consumers on the client. But in the current situation I have to write lots of ugly code to close the consumer , and some JMX code to verify that the count stays zero … … of course one strategy that I just thought of is that I could wait until I get an advisory queue message that the queue is GCd , but then I have latency where 1-2 message could be idle for a few minutes before they’re eventually serviced. -- Founder/CEO Spinn3r.com Location: *San Francisco, CA* blog: http://burtonator.wordpress.com … or check out my Google+ profile <https://plus.google.com/102718274791889610666/posts> <http://spinn3r.com>