You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2013/02/08 13:16:36 UTC
svn commit: r849865 - in /websites/production/activemq/content:
cache/main.pageCache osgi-integration.html
Author: dejanb
Date: Fri Feb 8 12:16:36 2013
New Revision: 849865
Log:
osgi integration
Modified:
websites/production/activemq/content/cache/main.pageCache
websites/production/activemq/content/osgi-integration.html
Modified: websites/production/activemq/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/activemq/content/osgi-integration.html
==============================================================================
--- websites/production/activemq/content/osgi-integration.html (original)
+++ websites/production/activemq/content/osgi-integration.html Fri Feb 8 12:16:36 2013
@@ -72,37 +72,22 @@
<tr>
<td valign="top" width="100%">
<div class="wiki-content maincontent">
-<p><b>This article applies to ActiveMQ version 5.4.0 or newer. If you use an older version proceed to the <a shape="rect" href="old-osgi-integration.html" title="Old OSGi Integration">following article</a>.</b></p>
-
<h1><a shape="rect" name="OSGiIntegration-Introduction"></a>Introduction</h1>
-<p>All ActiveMQ modules are packaged as OSGi bundles and can be used in any OSGi container. This article will provide more details on how to use ActiveMQ in <a shape="rect" class="external-link" href="http://karaf.apache.org/">Apache Karaf</a>, small OSGi based runtime. Apache Karaf was previously know as <em>ServiceMix kernel</em>, so informations found here are applicable to <a shape="rect" class="external-link" href="http://servicemix.apache.org/home.html">Apache ServiceMix Enterprise Service Bus</a> as well.</p>
+<p>This article will provide more details on how to use ActiveMQ in <a shape="rect" class="external-link" href="http://karaf.apache.org/">Apache Karaf</a>, small OSGi based runtime. Apache Karaf was previously know as <em>ServiceMix kernel</em>, so informations found here are applicable to <a shape="rect" class="external-link" href="http://servicemix.apache.org/home.html">Apache ServiceMix Enterprise Service Bus</a> as well.</p>
-<div class="panelMacro"><table class="noteMacro"><colgroup span="1"><col span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" valign="top"><img align="middle" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1">Procedures described in this article requires Apache Karaf 2.0.0 or newer</td></tr></table></div>
+<div class="panelMacro"><table class="noteMacro"><colgroup span="1"><col span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" valign="top"><img align="middle" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1">Procedures described in this article were tested using Apache karaf 2.3.0</td></tr></table></div>
<h1><a shape="rect" name="OSGiIntegration-Installation"></a>Installation</h1>
-<p>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.4.0 you can do it like this</p>
+<p>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.8.0 you can do it like this</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
-karaf@root> features:addUrl mvn:org.apache.activemq/activemq-karaf/5.4.0/xml/features
+karaf@root> features:addUrl mvn:org.apache.activemq/activemq-karaf/5.8.0/xml/features
</pre>
</div></div>
-<div class="panelMacro"><table class="infoMacro"><colgroup span="1"><col span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" valign="top"><img align="middle" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1"><b>Compatibility</b><br clear="none">ActiveMQ 5.5.0 is compatible with both Karaf version 2.1.x and 2.2.0 and newer, but you have to use different feature files depending on the version.
-
-<p>A default feature file </p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">mvn:org.apache.activemq/activemq-karaf/5.5.0/xml/features</pre>
-</div></div>
-
-<p>is compatible with versions 2.2.0 and newer. For compatibility with older versions use</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">mvn:org.apache.activemq/activemq-karaf/5.5.0/xml/features-2.1</pre>
-</div></div></td></tr></table></div>
<p>After that you should see newly added features</p>
@@ -110,115 +95,86 @@ karaf@root> features:addUrl mvn:org.a
<pre class="code-java">
karaf@root> features:list
State Version Name Repository
-[uninstalled] [3.0.3.RELEASE] spring karaf-2.0.0
-[uninstalled] [1.2.0 ] spring-dm karaf-2.0.0
-[uninstalled] [2.0.0 ] wrapper karaf-2.0.0
-[uninstalled] [2.0.0 ] obr karaf-2.0.0
-[uninstalled] [2.0.0 ] http karaf-2.0.0
-[uninstalled] [2.0.0 ] war karaf-2.0.0
-[uninstalled] [2.0.0 ] webconsole karaf-2.0.0
-[installed ] [2.0.0 ] ssh karaf-2.0.0
-[installed ] [2.0.0 ] management karaf-2.0.0
-[uninstalled] [5.4-SNAPSHOT ] activemq activemq-5.4-SNAPSHOT
-[uninstalled] [5.4-SNAPSHOT ] activemq-spring activemq-5.4-SNAPSHOT
-[uninstalled] [5.4-SNAPSHOT ] activemq-blueprint activemq-5.4-SNAPSHOT
-[uninstalled] [5.4-SNAPSHOT ] activemq-web-console activemq-5.4-SNAPSHOT
+[uninstalled] [5.8.0 ] activemq-broker activemq-5.8.0
+[uninstalled] [5.8.0 ] activemq-http activemq-5.8.0
+[uninstalled] [5.8.0 ] activemq-camel activemq-5.8.0
+[uninstalled] [5.8.0 ] activemq-web-console activemq-5.8.0
</pre>
</div></div>
-<p>From this point on you can choose to install ActiveMQ with Spring or Blueprint support, by doing</p>
+<p>Installing and running the broker is as simple as installing <tt>activemq-broker</tt> feature, like</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
-karaf@root> features:install activemq-spring
+karaf@root> features:install activemq-broker
</pre>
</div></div>
-<p>or </p>
+<p>This will install and start the full broker (including the web console), just as if you started the standalone distribution.</p>
+
+<h1><a shape="rect" name="OSGiIntegration-BrokerConfiguration"></a>Broker Configuration</h1>
+
+<p>Broker is configured using OSGi Config Admin mechanism and could be easily managed in <a shape="rect" class="external-link" href="http://karaf.apache.org/manual/latest-2.3.x/users-guide/configuration.html">Karaf</a>. Configuration can be done by modifying <tt>${KARAF_BASE}/etc/org.apache.activemq.server-default.cfg</tt> file or respective config admin property. An example of the file looks like</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-karaf@root> features:install activemq-blueprint
-</pre>
+<pre class="code-java">broker-name=amq-broker
+data=${karaf.data}/${broker-name}
+config=${karaf.base}/etc/activemq.xml</pre>
</div></div>
-<p>respectively.</p>
+<p>Mandatory properties are listed in the following table</p>
-<h1><a shape="rect" name="OSGiIntegration-Commands"></a>Commands</h1>
+<div class="table-wrap">
+<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Property Name </th><th colspan="1" rowspan="1" class="confluenceTh"> Property Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> broker-name </td><td colspan="1" rowspan="1" class="confluenceTd"> Name of the broker </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> config </td><td colspan="1" rowspan="1" class="confluenceTd"> Location of the XML configuration file </td></tr></tbody></table>
+</div>
-<p>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:</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
- browse Display selected messages in a specified destination
- bstat Displays useful broker statistics
- create-broker Creates a broker instance.
- destroy-broker Destroys a broker instance.
- list Lists all available brokers in the specified JMX context
- purge Delete selected destination's messages that matches the message selector
- query Display selected broker component's attributes and statistics
-</pre>
-</div></div>
-<div class="panelMacro"><table class="tipMacro"><colgroup span="1"><col span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" valign="top"><img align="middle" src="https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif" width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1"><b>Help on commands</b><br clear="none">To obtain some detailed help on a given command, you can run:
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-activemq:[command] --help
-</pre>
-</div></div></td></tr></table></div>
+<p>You can also use this file to set other properties which will replace placeholders in XML configuration file, as the <tt>${data</tt>} property is used in this example.</p>
-<h2><a shape="rect" name="OSGiIntegration-Brokercreation"></a>Broker creation</h2>
+<p>Default XML configuration file is located in the <tt>${KARAF_BASE}/etc/activemq.xml</tt> by default.</p>
-<p>By default, no broker is created, but the following command can be used to create one:</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-karaf@root> activemq:create-broker
-Creating file: xxx/deploy/localhost-broker.xml
+<h1><a shape="rect" name="OSGiIntegration-WebConsole"></a>Web Console</h1>
-Default ActiveMQ Broker (localhost) configuration file created at: xxx/deploy/localhost-broker.xml
-Please review the configuration and modify to suite your needs.
-</pre>
-</div></div>
+<p>Web Console is installed by default and can be reached at <a shape="rect" class="external-link" href="http://localhost:8181/activemqweb/" rel="nofollow">http://localhost:8181/activemqweb/</a></p>
-<p>It creates a broker with a sensible default configuration, but you can easily edit the mentioned file to modify the broker's configuration. Along with the broker, a pooled JMS <tt>ConnectionFactory</tt> is registered in OSGi and the broker is integrated with the transaction manager embedded in ServiceMix. The broker is also registered in the local JMX mbean server.</p>
+<p>The configuration for the console is done in a similar fashion to the broker itself. Configuration is located in <tt>${KARAF_BASE}/etc/org.apache.activemq.webconsole.cfg</tt> and by default looks like</p>
-<p>If you want to create multiple brokers, you need to give them some names. This can be done this way:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-karaf@root> activemq:create-broker --name mybroker
-Creating file: xxx/deploy/mybroker-broker.xml
-
-Default ActiveMQ Broker (mybroker) configuration file created at: xxx/deploy/mybroker-broker.xml
-Please review the configuration and modify to suite your needs. </pre>
+<pre class="code-java">webconsole.jms.url=tcp:<span class="code-comment">//localhost:61616
+</span>webconsole.jmx.url=service:jmx:rmi:<span class="code-comment">///jndi/rmi://localhost:1099/karaf-root
+</span>webconsole.jmx.user=karaf
+webconsole.jmx.password=karaf</pre>
</div></div>
-<p>By default the command will use Spring configuration. If you want to use Blueprint configuration use</p>
-
+<p><b>Optional:</b> 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.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
-karaf@root> activemq:create-broker --type blueprint
+webconsole.jms.user=system
+webconsole.jms.password=manager
</pre>
</div></div>
-<h2><a shape="rect" name="OSGiIntegration-Brokerdestruction"></a>Broker destruction</h2>
+<h1><a shape="rect" name="OSGiIntegration-Commands"></a>Commands</h1>
+
+<p>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:</p>
-<p>To remove an existing broker, simply run the following command:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
-karaf@root> activemq:destroy-broker
-
-Default ActiveMQ Broker (localhost) configuration file created at: xxx/deploy/localhost-broker.xml removed.
+ browse Display selected messages in a specified destination
+ bstat Displays useful broker statistics
+ list Lists all available brokers in the specified JMX context
+ purge Delete selected destination's messages that matches the message selector
+ query Display selected broker component's attributes and statistics
</pre>
</div></div>
-<p>To destroy a named broker, run the following command:</p>
+<div class="panelMacro"><table class="tipMacro"><colgroup span="1"><col span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" valign="top"><img align="middle" src="https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif" width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1"><b>Help on commands</b><br clear="none">To obtain some detailed help on a given command, you can run:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
-karaf@root> activemq:destroy-broker --name mybroker
-
-Default ActiveMQ Broker (localhost) configuration file created at: xxx/deploy/mybroker-broker.xml removed.
+activemq:[command] --help
</pre>
-</div></div>
+</div></div></td></tr></table></div>
<h2><a shape="rect" name="OSGiIntegration-Brokerquerying"></a>Broker querying</h2>
@@ -241,54 +197,6 @@ karaf@root> activemq:query --jmxlocal
<p>It will display informations about the connectors, list of queues, etc...</p>
<p>You can also browse or purge queues using the <tt>activemq:browse</tt> and <tt>activemq:purge</tt> commands. </p>
-
-<h2><a shape="rect" name="OSGiIntegration-WebConsole"></a>Web Console</h2>
-
-<p><a shape="rect" href="web-console.html" title="Web Console">Web Console</a> is included in ActiveMQ distribution and you'll probably want to have it installed in Karaf as well to monitor your broker. </p>
-
-<p>In order to use web console you need first to install war feature</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-karaf@root> features:install war
-</pre>
-</div></div>
-
-<p>Now you can do something like:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-karaf@root> features:install activemq-web-console
-</pre>
-</div></div>
-
-<p>This will install and start the web console (with embedded broker), which you can use at</p>
-
-<p><a shape="rect" class="external-link" href="http://localhost:8181/activemqweb/" rel="nofollow">http://localhost:8181/activemqweb/</a></p>
-
-<div class="panelMacro"><table class="noteMacro"><colgroup span="1"><col span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" valign="top"><img align="middle" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1">Web console can fail to start if you have another broker already running in the container</td></tr></table></div>
-
-<p>There a big chance that you don't want to monitor an embedded broker, but the broker you have started separately (in the OSGi runtime or elsewhere). To configure your web console to do that, you have to do the following. First, exit your OSGi runtime. Now edit the <tt>etc/system.properties</tt> file and add some configuration details. The following configuration snippet</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-webconsole.type=properties
-webconsole.jms.url=tcp:<span class="code-comment">//localhost:61616
-</span>webconsole.jmx.url=service:jmx:rmi:<span class="code-comment">///jndi/rmi://localhost:1099/karaf-root
-</span>webconsole.jmx.user=karaf
-webconsole.jmx.password=karaf
-</pre>
-</div></div>
-
-<p>should work fine with default broker started in the Karaf (ServiceMix). Adapt it to your specific needs. When you start you container again, the web console should be monitoring the remote broker.</p>
-
-<p><b>Optional:</b> 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.</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-webconsole.jms.user=system
-webconsole.jms.password=manager
-</pre>
-</div></div>
</div>
</td>
<td valign="top">