LibraryLink ToToggle FramesPrintFeedback

Manage Brokers from the Console

As well as installing the libraries needed for running a ActiveMQ broker, the activemq feature also provides a set of console commands for managing and monitoring broker instances.

If you do not already have a broker configuration file, the activemq:create-broker console command provides a simple way of creating a new broker instance with default settings. To create a new broker with the broker name, test, enter the following console command:

karaf@root> activemq:create-broker --name test

After executing this command, you should see the broker configuration file, test-broker.xml, in the InstallDir/deploy directory. You can edit the settings in this file in order to change the broker configuration. As soon as any changes are saved to the test-broker.xml file, the OSGi container re-reads the broker configuration.


If the activemq-broker feature is installed in the OSGi container, you might get an IP port conflict when you create a broker in this way, because the default broker is also listening on IP port, 61616. To resolve this conflict, you could either edit the test-broker.xml configuration, to change the port, or you could disable the default broker, as described in The Default Broker.

Broker instances created using the activemq:create-broker command are configured to store their data in the following directory:


You can use the activemq:destroy-broker console command to remove a broker instance. For example, to destroy the broker named test, enter the following console command.

karaf@root> activemq:destroy-broker --name test

Alternatively, you can simply delete the file, test-broker.xml, from the hot deploy directory, InstallDir/deploy.

You can use the activemq:query console command to monitor the status of the broker (or possibly brokers) currently deployed in the container. The following command connects to the container's JMX port and downloads all of the broker's status:

karaf@root> activemq:query --jmxlocal

Typically, the amount of data retrieved by this command is unwieldy. It is better to filter the data by selecting specific queues or topics. For example, to view the status of all queues whose name starts with camel., enter the following command:

karaf@root> activemq:query --jmxlocal -QQueue=camel.*

For more details, see the activemq:query help text, by entering activemq:query --help.

As an alternative to querying the broker with the activemq:query command, you can monitor the broker through any JMX monitoring tool, such as JConsole (a standard utility provided with Sun's Java Development Kit). For an example of how to monitor the broker using JConsole, see JMS Endpoints in a Router Application.