You can interrogate the various JMX MBeans that ActiveMQ exposes to get information about the number of messages enqueued, dequeued, dispatched, etc., and then compare the current values against the last time you polled to see if they haven't changed. If you're going to be doing that for more than a few destinations, you'll probably want to consider enabling Jolokia since direct JMX interaction with a remote broker is pretty slow. See http://activemq.apache.org/how-can-i-monitor-activemq.html and http://activemq.apache.org/rest.html for more information.
You could also use queue browsing to examine the first message on your queue, but be aware that messages that have been dispatched to a consumer but not yet consumed are still considered to be on the queue but are not browseable until/unless the consumer closes without acknowledging the message, so be sure to account for that in any algorithm you end up implementing. Tim On Sun, Jan 24, 2016 at 12:42 PM, Scammell <mark.har...@meridianenergy.co.nz > wrote: > Hi, > > I'm using ActiveMQ version 5.10.1 and have a requirement to regularly poll > my ActiveMQ installation and identify when a message has been sitting on a > specified queue for a specified period of time. > > What are my programmatic options for achieving this? > > Thanks in advance for any advice. > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/Monitoring-for-messages-older-than-a-defined-period-of-time-tp4706358.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. >