That's an interesting use-case.  I suspect there are ways to accomplish this
within ActiveMQ, but I wouldn't recommend going that route - you'll end up
in areas of the code that get less attention and solving problems into which
you run will be harder since it doesn't match the use-cases on which
ActiveMQ developers are frequently working.

ActiveMQ is focused on asynchronous messaging, which is push-based and
requires (as stated in the JMS spec) continuous, timely receipt of messages. 
It is not a store nor a tool for queries (e.g. "get me the last 20").

Something like EHCache or hazelcast may work better for the use case - based
on my limited understanding of the problem.

For example, if I wanted to always have the last 20 items, and only the last
20, of a stream of items available to query, the following comes to mind:

* Producer into an ActiveMQ queue
* Consumer from ActiveMQ updates EHCache with each new message
** EHCache structure maintains a limited-size queue
** New entries pushed into the queue
** Once size limit reached, drop the oldest from the queue
** Use EHCache locking to guarantee the queue size is atomically updated




--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Message-throttling-problem-tp4684744p4684748.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to