## Querying a Broker

### Overview

The query task allows you to query the current JMX context for broker statistics and information.

To display all attributes and object name information of all registered MBeans in the default JMX context, type:

activemq-admin query

### Filtering specific MBeans by type

You can query a specific MBean object based on its type and an identifier using the `-Q` option as follows:

activemq-admin query -Q`MBeanType`=`Name`

For example, to display all the attributes and object name information of the destination topic 'TEST.FOO', type:

activemq-admin query -QTopic=TEST.FOO

To display all the brokers in a context whose name ends in "host", type:

activemq-admin query -QBroker=*host

To display the attributes and object name information of all registered queues, type:

activemq-admin query -QQueue=*

### Excluding MBeans from a query by type

To exclude a specific MBean object based on its type and an identifier, use the `-xQ` option as follows:

activemq-admin query -xQ`MBeanType`=`Name`

For example, to display all the attributes and object name information of all topics ending with '.FOO' except those that also begin with 'ActiveMQ.Advisory.', type:

activemq-admin query -QTopic=*.FOO -xQTopic=ActiveMQ.Advisory.*