Statistics are part of a message broker implementation and thus vendor-specific. One popular implementations is ActiveMQ. It can be run in WebLogic Server or WebLogic Express.
Note: There are obviously many other JMS implementations around, and you should carefully evaluate for yourself which implementation suits your needs. Nevertheless, I shall use it as an example to point out the relevant features for your case:
Beginning with version 5.3, ActiveMQ ships with a statistics plugin
that can be used to retrieve statistics from the broker or its destinations.
You should be able to actively poll statistics from within your code by sending messages to specific destinations within the broker, see linked documentation for details.
Another feature of ActiveMQ is Advisory messages. Enable it in your broker's configuration and it
allows you to watch the system using regular JMS messages.
In this way, you can passively react to certain events in the messaging system , e.g. when a queue exceeds some threshold.