On Mon, Nov 23, 2009 at 8:48 AM, moreno9000 <moreno.ma...@italtel.it> wrote: > > Yes, > when a procuder calls send() method, I'd like to intercept > the request, verify number of messages in destination queue, > throw an exception if number of msg, after this last send(), > exceed a predefined limit.
Does this mean that you're going to discard new messages that are sent to the queue if a predefined number of messages already exists? Seems like an odd use case. What exactly are you trying to achieve? Please describe the business use case, not the code use case. You'll need to continually grab the current message count using the ActiveMQ JMX API and use that to track message counts. Just be aware that there's a lot of asynchronous behavior that takes place inside the broker. This asynchronous behavior can affect an accurate message count from one moment to the next, but this is the best way. Bruce -- perl -e 'print unpack("u30","D0G)u8...@4vyy9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );' ActiveMQ in Action: http://bit.ly/2je6cQ Blog: http://bruceblog.org/ Twitter: http://twitter.com/brucesnyder