This article will provide more details on how to use ActiveMQ in Apache Karaf, small OSGi based runtime. Apache Karaf was previously know as ServiceMix kernel, so informations found here are applicable to Apache ServiceMix Enterprise Service Bus as well.


Procedures described in this article were tested using Apache karaf 2.3.0


ActiveMQ provides Karaf features which will help you integrate and use the broker in OSGi environment. For starters you need to add the features URL to Karaf. For version 5.9.0 you can do it like this:

After that you should see newly added features

Installing and running the broker is as simple as installing activemq-broker feature, like

This will install and start the full broker (including the web console), just as if you started the standalone distribution.

Broker Configuration

Broker is configured using OSGi Config Admin mechanism and could be easily managed in Karaf. Configuration can be done by modifying ${KARAF_BASE}/etc/org.apache.activemq.server-default.cfg file or respective config admin property. An example of the file looks like

Mandatory properties are listed in the following table

Property Name

Property Description


Name of the broker


Location of the XML configuration file

You can also use this file to set other properties which will replace placeholders in XML configuration file, as the ${data} property is used in this example.

Default XML configuration file is located in the ${KARAF_BASE}/etc/activemq.xml by default.

Web Console

Web Console is installed by default and can be reached at http://localhost:8181/activemqweb/

The configuration for the console is done in a similar fashion to the broker itself. Configuration is located in ${KARAF_BASE}/etc/org.apache.activemq.webconsole.cfg and by default looks like

Optional: In order to use the ActiveMQ console with a broker configured with authentication, it is necessary to configure the username/password for JMS connection as well.


After these simple steps you have all necessary libraries installed in the container. Also, now you have specific commands on your disposal that you can use to manage your broker:

Help on commands


To obtain some detailed help on a given command, you can run:

Broker querying

Several commands are available to query the broker. To address local brokers, you need to use the --jmxlocal parameter.

The following command displays available brokers:

To have more detailed informations, run:

It will display informations about the connectors, list of queues, etc...

You can also browse or purge queues using the activemq:browse and activemq:purge commands.

© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram