activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Mielke (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache ActiveMQ > Configuring Transports
Date Fri, 15 Nov 2013 14:08:01 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/1/_/styles/combined.css?spaceKey=ACTIVEMQ&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/ACTIVEMQ/Configuring+Transports">Configuring
Transports</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~tmielke">Torsten
Mielke</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >As of 5.8.0 ActiveMQ has support for
AMQP. For details see the [AMQP] Transport Reference. <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h3.
The MQTT Transport <br>Starting with 5.6.0 ActiveMQ also supports MQTT. Its a light
weight publish/subscribe messaging transport. See the [MQTT] Transport Reference for details.
<br> <br></td></tr>
            <tr><td class="diff-unchanged" >h3. The TCP Transport <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="ConfiguringTransports-Transportconfigurationoptions"></a>Transport
configuration options</h2>

<p>One of the first kinds of URI you are likely to use is a transport URI to connect
to a broker using a kind of transport. Generally TCP or VM are the first transports you'll
use.</p>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/forbidden.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>Be careful
about whitespace</b><br />All of the following URI configurations are based on
the java.net.URI class which does not allow whitespace to be used. So if you are using <b>failover:</b>
or <b>static:</b> URIs, do not put any whitespace around the <b>,</b>
symbol.</td></tr></table></div>

<h3><a name="ConfiguringTransports-TheVMTransport"></a>The VM Transport</h3>

<p>The VM transport allows clients to connect to each other inside the VM without the
overhead of the network communication. The connection used is not that of a socket connection
but instead uses direct method invocations to enable a high performance embedded messaging
system.</p>

<p>The first client to use the VM connection will boot an embedded broker. Subsequent
connections will attach that the same broker. Once all VM connections to the broker have been
closed, the embedded broker will automatically shutdown.</p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/VM+Transport+Reference"
title="VM Transport Reference">VM Transport Reference</a></p>

<h3><a name="ConfiguringTransports-TheAMQPTransport"></a>The AMQP Transport</h3>
<p>As of 5.8.0 ActiveMQ has support for AMQP. For details see the <a href="/confluence/display/ACTIVEMQ/AMQP"
title="AMQP">AMQP</a> Transport Reference.</p>

<h3><a name="ConfiguringTransports-TheMQTTTransport"></a>The MQTT Transport</h3>
<p>Starting with 5.6.0 ActiveMQ also supports MQTT. Its a light weight publish/subscribe
messaging transport. See the <a href="/confluence/display/ACTIVEMQ/MQTT" title="MQTT">MQTT</a>
Transport Reference for details.</p>

<h3><a name="ConfiguringTransports-TheTCPTransport"></a>The TCP Transport</h3>

<p>The TCP transport allows clients to connect a remote ActiveMQ using a a TCP socket.</p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/TCP+Transport+Reference"
title="TCP Transport Reference">TCP Transport Reference</a></p>

<h3><a name="ConfiguringTransports-TheNIOTransport"></a>The NIO Transport</h3>

<p>Same as the TCP transport, except that the <a href="http://en.wikipedia.org/wiki/New_I/O"
class="external-link" rel="nofollow">New I/O (NIO)</a> package is used, which may
provide better performance. The Java NIO package should not be confused with IBM's <a href="http://java.sys-con.com/read/46658.htm"
class="external-link" rel="nofollow">AIO4J </a> package. </p>

<p>To switch from TCP to NIO, simply change the scheme portion of the URI. Here's an
example as defined within a broker's XML configuration file.  </p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;broker&gt;
  ...
  &lt;transportConnectors&gt;
    &lt;transportConnector name="nio" uri="nio://0.0.0.0:61616"/&gt;  
  &lt;/&lt;transportConnectors&gt;
  ...
&lt;/broker&gt;
</pre>
</div></div>

<p>Trying to use nio transport url on the client side will instantiate the regular TCP
transport.</p>

<h3><a name="ConfiguringTransports-TheSSLTransport"></a>The SSL Transport</h3>

<p>This allows you to talk over TCP using SSL. </p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/SSL+Transport+Reference"
title="SSL Transport Reference">SSL Transport Reference</a></p>

<h3><a name="ConfiguringTransports-TheNIOSSLTransport"></a>The NIO SSL Transport</h3>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>Availability</b><br
/>Available since 5.6</td></tr></table></div>	

<p>Implementing SSL transport over NIO. This allows you to connect large number of SSL
clients to a single broker instance. It's server side transport-option only</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;broker&gt;
  ...
  &lt;transportConnectors&gt;
    &lt;transportConnector name="nio+ssl" uri="nio+ssl://0.0.0.0:61616"/&gt;  
  &lt;/&lt;transportConnectors&gt;
  ...
&lt;/broker&gt;
</pre>
</div></div>

<p>Trying to use <tt>nio+ssl</tt> transport url on the client side will
instantiate the regular SSL transport.</p>

<h3><a name="ConfiguringTransports-ThePeerTransport"></a>The Peer Transport</h3>

<p>The Peer transport provides a peer-to-peer network with ActiveMQ. What actually happens
is the peer transport uses the VM transport to create and connect to a local embedded broker
but which configures the embedded broker to establish network connections to other peer embedded
brokers.</p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/Peer+Transport+Reference"
title="Peer Transport Reference">Peer Transport Reference</a></p>

<h3><a name="ConfiguringTransports-TheUDPTransport"></a>The UDP Transport</h3>

<p>This allows you to talk over UDP. </p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/UDP+Transport+Reference"
title="UDP Transport Reference">UDP Transport Reference</a></p>

<h3><a name="ConfiguringTransports-TheMulticastTransport"></a>The Multicast
Transport</h3>

<p>This allows you to talk over Multicast. </p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/Multicast+Transport+Reference"
title="Multicast Transport Reference">Multicast Transport Reference</a></p>

<h3><a name="ConfiguringTransports-TheHTTPandHTTPSTransport"></a>The HTTP
and HTTPS Transport</h3>

<p>This allows the ActiveMQ client and broker to tunnel over HTTP. If the client is
not JMS you might want to look at <a href="/confluence/display/ACTIVEMQ/REST" title="REST">REST</a>
or <a href="/confluence/display/ACTIVEMQ/Ajax" title="Ajax">Ajax</a> support instead.</p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/HTTP+and+HTTPs+Transports+Reference"
title="HTTP and HTTPs Transports Reference">HTTP and HTTPs Transports Reference</a></p>

<h3><a name="ConfiguringTransports-TheWebSocketsTransport"></a>The WebSockets
Transport</h3>
<p>This transport uses the new HTML5 WebSockets to exchange messages with the broker.
For more information see the <a href="/confluence/display/ACTIVEMQ/WebSockets" title="WebSockets">WebSockets</a>
Transport Reference</p>

<h2><a name="ConfiguringTransports-GeneralPurposeURIs"></a>General Purpose
URIs</h2>

<p>You can configure other features via the URI syntax as follows...</p>

<h3><a name="ConfiguringTransports-ConnectionConfigurationURI"></a>Connection
Configuration URI</h3>

<p>Any Apache ActiveMQ JMS connection can be configured using the URL or explicitly
setting properties on the <a href="http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQConnection.html"
class="external-link" rel="nofollow">ActiveMQConnection</a> or <a href="http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQConnectionFactory.html"
class="external-link" rel="nofollow">ActiveMQConnectionFactory</a> objects themselves.</p>

<p>For more information see <a href="/confluence/display/ACTIVEMQ/Connection+Configuration+URI"
title="Connection Configuration URI">Connection Configuration URI</a></p>

<h3><a name="ConfiguringTransports-DestinationOptions"></a>Destination Options</h3>

<p>You can configure various consumer related options using <a href="/confluence/display/ACTIVEMQ/Destination+Options"
title="Destination Options">Destination Options</a> which allow you to configure
destinations using URI syntax.</p>

<h3><a name="ConfiguringTransports-BrokerConfigurationURI"></a>Broker Configuration
URI</h3>

<p>You can use a <a href="/confluence/display/ACTIVEMQ/Broker+Configuration+URI"
title="Broker Configuration URI">Broker Configuration URI</a> to configure an embedded
broker, either using the BrokerFactory helper class from Java or using the activemq shell
script. For more details see <a href="/confluence/display/ACTIVEMQ/Run+Broker" title="Run
Broker">How to Run a Broker</a></p>

<h3><a name="ConfiguringTransports-ConfiguringWireFormats"></a>Configuring
Wire Formats</h3>

<p>Any transport which involves marshalling messages onto some kind of network transport
like TCP or UDP will typically use the <a href="/confluence/display/ACTIVEMQ/OpenWire"
title="OpenWire">OpenWire</a> format. This is configurable to customize how things
appear on the wire.</p>

<p>For more information see <a href="/confluence/display/ACTIVEMQ/Configuring+Wire+Formats"
title="Configuring Wire Formats">Configuring Wire Formats</a></p>

<h2><a name="ConfiguringTransports-HighLevelProtocolURIs"></a>High Level
Protocol URIs</h2>

<p>The following higher level protocols can be configured via URI</p>

<h3><a name="ConfiguringTransports-TheFailoverTransport"></a>The Failover
Transport</h3>

<p>The Failover transport layers reconnect logic on top of any of the other transports.
This is what used to be the Reliable transport in ActiveMQ 3. Its configuration syntax allows
you to specify any number of composite URIs. The Failover transport randomly chooses one of
the composite URIs and attempts to establish a connection to it. If it does not succeed or
if it subsequently fails, a new connection is established to one of the other URIs in the
list.</p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/Failover+Transport+Reference"
title="Failover Transport Reference">Failover Transport Reference</a></p>

<h3><a name="ConfiguringTransports-TheFanoutTransport"></a>The Fanout Transport</h3>

<p>The Fanout transport layers reconnect and replicate logic on top of any of the other
transports. It is used replicate commands to multiple brokers.</p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/Fanout+Transport+Reference"
title="Fanout Transport Reference">Fanout Transport Reference</a></p>

<h2><a name="ConfiguringTransports-UsingDiscovery"></a>Using Discovery</h2>

<p>Often when using transports like TCP you want to use <a href="/confluence/display/ACTIVEMQ/Discovery"
title="Discovery">Discovery</a> to locate the available brokers. This is different
from using, say, <a href="/confluence/display/ACTIVEMQ/Multicast+Transport+Reference" title="Multicast
Transport Reference">Multicast</a> - as the actual main communication is over TCP
but multicast is purely used to discover the location of brokers.</p>

<h3><a name="ConfiguringTransports-TheDiscoveryTransport"></a>The Discovery
Transport</h3>

<p>The Discovery transport works just like the reliable transport, except that it uses
a discovery agent to locate the list of URIs to connect to.</p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/Discovery+Transport+Reference"
title="Discovery Transport Reference">Discovery Transport Reference</a></p>

<h3><a name="ConfiguringTransports-TheZeroConfTransport"></a>The ZeroConf
Transport</h3>

<p>The ZeroConf transport provides <a href="/confluence/display/ACTIVEMQ/Discovery"
title="Discovery">Discovery</a> and it works like the <a href="/confluence/display/ACTIVEMQ/Discovery+Transport+Reference"
title="Discovery Transport Reference">Discovery Transport</a> but rather than using
our own multicast based discovery mechanism (which allows you to configure the exact multicast
address and port, etc.), the <a href="/confluence/display/ACTIVEMQ/ZeroConf" title="ZeroConf">ZeroConf</a>
transport is used instead.</p>

<p>For more information see the <a href="/confluence/display/ACTIVEMQ/ZeroConf+Transport+Reference"
title="ZeroConf Transport Reference">ZeroConf Transport Reference</a></p>


<h3><a name="ConfiguringTransports-Serversideoptions"></a>Server side options</h3>

<p>There are a number of options that can be used for changing behaviour on the server
for the TransportConnector in the ActiveMQ broker configuration. These are:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>property name</th>
<th class='confluenceTh'>default</th>
<th class='confluenceTh'>description</th>
</tr>
<tr>
<td class='confluenceTd'>uri</td>
<td class='confluenceTd'>null</td>
<td class='confluenceTd'>the bind address for the transport</td>
</tr>
<tr>
<td class='confluenceTd'>name</td>
<td class='confluenceTd'>null</td>
<td class='confluenceTd'>the name of the TransportConnector instance</td>
</tr>
<tr>
<td class='confluenceTd'>discoveryURI</td>
<td class='confluenceTd'>null</td>
<th class='confluenceTh'>if set, the multicast discovery address for client connections
to find the broker</th>
</tr>
<tr>
<td class='confluenceTd'>enableStatusMonitor</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>will monitor connections to determine if they are blocked</td>
</tr>
<tr>
<td class='confluenceTd'>updateClusterClients</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>if enabled, will update client connections (if they use the
failover:// transport) of changes to the broker cluster</td>
</tr>
<tr>
<td class='confluenceTd'>rebalanceClusterClients</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>will automatically rebalance clients across the cluster on
changes of topology</td>
</tr>
<tr>
<td class='confluenceTd'>updateClusterClientsOnRemove</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>will update clients if a broker is removed from the cluster</td>
</tr>
<tr>
<td class='confluenceTd'>updateClusterFilter</td>
<td class='confluenceTd'>null</td>
<td class='confluenceTd'>comma separated list of regular expressions. Brokers with the
a name matching the pattern will be included for client updates</td>
</tr>
<tr>
<td class='confluenceTd'><font color="red"> allowLinkStealing</font></td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>this is enabled for default for mqtt transport. Link Stealing
is where the last of two or more connections with the same id (clinetId for JMS) is deemed
the valid connection and the older one is closed by the broker.</td>
</tr>
</tbody></table>
</div>


<p><sub>Note: properties in <font color="red">red</font> are version
5.10 (and higher) options only.</sub></p>

<p>An example configuration would be:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;broker&gt;
  ...
  &lt;transportConnectors&gt;
    &lt;transportConnector name="openwire" uri="tcp://0.0.0.0:61616" enableStatusMonitor="true"/&gt;
 
  &lt;/&lt;transportConnectors&gt;
  ...
&lt;/broker&gt;
</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=ACTIVEMQ">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/ACTIVEMQ/Configuring+Transports">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=36080&revisedVersion=35&originalVersion=34">View
Changes</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message