blob: a996fce33c13f3636ef952e6b077ccfeb6a10c03 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ActiveMQ</title>
<link rel="icon" type="image/png" href="/assets/img/favicon.png">
<link rel="stylesheet" href="/css/main.css">
<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js" integrity="sha384-SlE991lGASHoBfWbelyBPLsUlwY1GwNDJo3jSJO04KZ33K2bwfV9YBauFfnzvynJ" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light fixed-top">
<div class="container">
<!-- <a class="navbar-brand mr-auto" href="#"><img style="height: 50px" src="assets/img/apache-feather.png" /></a> -->
<a class="navbar-brand mr-auto" href="/"><img src="/assets/img/activemq_logo_black_small.png" style="height: 50px"/></a>
<button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="ml-auto collapse navbar-collapse" id="navbarContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link active" href="/index.html">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" id="navbarDropdownComponents" data-target="#" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Components</a>
<ul class="dropdown-menu dropdown-menu-center" aria-labelledby="navbarDropdownComponents">
<div class="row">
<div class="col-12">
<ul class="multi-column-dropdown">
<li class="nav-item"><a class="dropdown-item" href="/components/classic">ActiveMQ 5</a></li>
<li class="nav-item"><a class="dropdown-item" href="/components/artemis/">ActiveMQ Artemis</a></li>
<li class="nav-item"><a class="dropdown-item" href="/components/nms">NMS Clients</a></li>
<li class="nav-item"><a class="dropdown-item" href="/components/cms">CMS Client</a></li>
</ul>
</div>
</div>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link" id="navbarDropdownCommunity" data-target="#" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Contact</a>
<ul class="dropdown-menu dropdown-menu-center multi-column columns-1" aria-labelledby="navbarDropdownCommunity">
<div class="row">
<div class="col-12">
<ul class="multi-column-dropdown">
<li class="nav-item"><a class="dropdown-item" href="/contact#mailing">Mailing Lists</a></li>
<li class="nav-item"><a class="dropdown-item" href="/contact#chat">Chat</a></li>
<li class="nav-item"><a class="dropdown-item" href="/contact#issues">Report Issues</a></li>
<li class="nav-item"><a class="dropdown-item" href="/contact#contributing">Contributing</a></li>
<li class="nav-item"><a class="dropdown-item" href="/security-advisories.html">Security</a></li>
</ul>
</div>
</div>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link" id="navbarDropdownTeam" data-target="#" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Apache</a>
<ul class="dropdown-menu dropdown-menu-center multi-column columns-1" aria-labelledby="navbarDropdownTeam">
<div class="row">
<div class="col-sm-12">
<ul class="multi-column-dropdown">
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org">The Apache Software Foundation</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org/licenses/">License</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org/foundation/thanks.html">Thanks</a></li>
<li class="nav-item"><a class="dropdown-item" href="/security-advisories.html">Security</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org/events/current-event">Events</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://people.apache.org/phonebook.html?pmc=activemq">PMC & Committers</a></li>
<li class="nav-item"><a class="dropdown-item" href="/team/reports">Board Reports</a></li>
</ul>
</div>
</div>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="content">
<div class="page-title-activemq5">
<div class="container">
<h1>ActiveMQ Connection URIs</h1>
</div>
</div>
<div class="container" >
<div class="row" style="margin-top: 30px">
<div class="col-12 activemq5">
<p><a href="using-activemq">Using ActiveMQ</a> &gt; <a href="configuring-transports">Configuring Transports</a> &gt; <a href="activemq-connection-uris">ActiveMQ Connection URIs</a></p>
<h2 id="transport-configuration-options">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>
<blockquote>
<p><strong>Be careful about whitespace</strong></p>
<p>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 <code class="highlighter-rouge">failover:</code> or <code class="highlighter-rouge">static:</code> URIs, do not put any whitespace around the <code class="highlighter-rouge">','</code> symbol.</p>
</blockquote>
<h3 id="the-auto-transport">The AUTO Transport</h3>
<p>Starting with 5.13.0 ActiveMQ has support for automatic wire protocol detection over TCP, SSL, NIO, and NIO SSL.  OpenWire, STOMP, AMQP, and MQTT are supported.  For details see the <a href="auto">AUTO</a> Transport Reference.</p>
<h3 id="the-vm-transport">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="vm-transport-reference">VM Transport Reference</a></p>
<h3 id="the-amqp-transport">The AMQP Transport</h3>
<p>As of 5.8.0 ActiveMQ has support for AMQP. For details see the <a href="amqp">AMQP</a> Transport Reference.</p>
<h3 id="the-mqtt-transport">The MQTT Transport</h3>
<p>Starting with 5.6.0 ActiveMQ also supports <a href="http://mqtt.org/">MQTT</a>. Its a light weight publish/subscribe messaging transport. See the <a href="mqtt">MQTT</a> Transport Reference for details.</p>
<h3 id="the-tcp-transport">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="tcp-transport-reference">TCP Transport Reference</a></p>
<h3 id="the-nio-transport">The NIO Transport</h3>
<p>Same as the TCP transport, except that the <a href="http://en.wikipedia.org/wiki/New_I/O">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">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="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&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;
</code></pre></div></div>
<p>Trying to use nio transport url on the client side will instantiate the regular TCP transport. For more information see the <a href="nio-transport-reference">NIO Transport Reference</a></p>
<h3 id="the-ssl-transport">The SSL Transport</h3>
<p>This allows you to talk over TCP using SSL. For more information see the <a href="ssl-transport-reference">SSL Transport Reference</a></p>
<h3 id="the-nio-ssl-transport">The NIO SSL Transport</h3>
<blockquote>
<p><strong>Availability</strong></p>
<p>Available since 5.6</p>
</blockquote>
<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="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&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;
</code></pre></div></div>
<p>Trying to use <code class="highlighter-rouge">nio+ssl</code> transport url on the client side will instantiate the regular SSL transport.</p>
<h3 id="the-peer-transport">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="peer-transport-reference">Peer Transport Reference</a></p>
<h3 id="the-udp-transport">The UDP Transport</h3>
<p>This allows you to talk over UDP.</p>
<p>For more information see the <a href="udp-transport-reference">UDP Transport Reference</a></p>
<h3 id="the-multicast-transport">The Multicast Transport</h3>
<p>This allows you to talk over Multicast.</p>
<p>For more information see the <a href="multicast-transport-reference">Multicast Transport Reference</a></p>
<h3 id="the-http-and-https-transport">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="rest">REST</a> or <a href="ajax">Ajax</a> support instead.</p>
<p>For more information see the <a href="http-and-https-transports-reference">HTTP and HTTPs Transports Reference</a></p>
<h3 id="the-websockets-transport">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="websockets">WebSockets</a> Transport Reference</p>
<h3 id="the-stomp-transport">The Stomp Transport</h3>
<p>A plain text transport that can be used with many languages. See <a href="stomp">Stomp</a> for more details.</p>
<h2 id="general-purpose-uris">General Purpose URIs</h2>
<p>You can configure other features via the URI syntax as follows…</p>
<h3 id="connection-configuration-uri">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">ActiveMQConnection</a> or <a href="http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQConnectionFactory.html">ActiveMQConnectionFactory</a> objects themselves.</p>
<p>For more information see <a href="connection-configuration-uri">Connection Configuration URI</a></p>
<h3 id="destination-options">Destination Options</h3>
<p>You can configure various consumer related options using <a href="destination-options">Destination Options</a> which allow you to configure destinations using URI syntax.</p>
<h3 id="broker-configuration-uri">Broker Configuration URI</h3>
<p>You can use a <a href="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="run-broker">How to Run a Broker</a></p>
<h3 id="configuring-wire-formats">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="openwire">OpenWire</a> format. This is configurable to customize how things appear on the wire.</p>
<p>For more information see <a href="configuring-wire-formats">Configuring Wire Formats</a></p>
<h2 id="high-level-protocol-uris">High Level Protocol URIs</h2>
<p>The following higher level protocols can be configured via URI</p>
<h3 id="the-failover-transport">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="failover-transport-reference">Failover Transport Reference</a></p>
<h3 id="the-fanout-transport">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="fanout-transport-reference">Fanout Transport Reference</a></p>
<h2 id="using-discovery">Using Discovery</h2>
<p>Often when using transports like TCP you want to use <a href="discovery">Discovery</a> to locate the available brokers. This is different from using, say, <a href="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 id="the-discovery-transport">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="discovery-transport-reference">Discovery Transport Reference</a></p>
<h3 id="the-zeroconf-transport">The ZeroConf Transport</h3>
<p>The ZeroConf transport provides <a href="discovery">Discovery</a> and it works like the <a href="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="zeroconf">ZeroConf</a> transport is used instead.</p>
<p>For more information see the <a href="zeroconf-transport-reference">ZeroConf Transport Reference</a></p>
<h3 id="server-side-options">Server side options</h3>
<p>There are a number of options that can be used for changing behavior on the server for the <code class="highlighter-rouge">TransportConnector</code> in the ActiveMQ broker configuration. These are:</p>
<table>
<thead>
<tr>
<th>property name</th>
<th>default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="highlighter-rouge">allowLinkStealing</code></td>
<td><code class="highlighter-rouge">false</code></td>
<td>This is enabled for default for MQTT transport. Link Stealing is where the last of two or more connections with the same id (clientID for JMS) is deemed the valid connection and the older one is closed by the broker.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">discoveryURI</code></td>
<td><code class="highlighter-rouge">null</code></td>
<td>If set, the multicast discovery address for client connections to find the broker.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">enableStatusMonitor</code></td>
<td><code class="highlighter-rouge">false</code></td>
<td>Will monitor connections to determine if they are blocked.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">name</code></td>
<td><code class="highlighter-rouge">null</code></td>
<td>The name of the <code class="highlighter-rouge">TransportConnector</code> instance.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">rebalanceClusterClients</code></td>
<td><code class="highlighter-rouge">false</code></td>
<td>Will automatically re-balance clients across the cluster on changes of topology.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">updateClusterClients</code></td>
<td><code class="highlighter-rouge">false</code></td>
<td>If enabled, will update client connections (if they use the <code class="highlighter-rouge">failover://</code> transport) of changes to the broker cluster.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">updateClusterClientsOnRemove</code></td>
<td><code class="highlighter-rouge">false</code></td>
<td>Will update clients if a broker is removed from the cluster.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">updateClusterFilter</code></td>
<td><code class="highlighter-rouge">null</code></td>
<td>Comma separated list of regular expressions. Brokers with a name matching the pattern will be included for client updates.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">uri</code></td>
<td><code class="highlighter-rouge">null</code></td>
<td>The bind address for the transport.</td>
</tr>
</tbody>
</table>
<p>Example configuration:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;broker&gt;
   &lt;!-- ... --&gt;
   &lt;transportConnectors&gt;
     &lt;transportConnector name="openwire" uri="tcp://0.0.0.0:61616" enableStatusMonitor="true"/&gt;
   &lt;/&lt;transportConnectors&gt;
   &lt;!-- ... --&gt;
&lt;/broker&gt;
</code></pre></div></div>
</div>
</div>
</div>
</div>
<div class="row sitemap">
<div class="col-sm-12">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">
<div >
<img class="float-left" style="max-height: 100px" src="/assets/img/activemq_logo_white_vertical_small.png"/>
</div>
</div>
<div style="text-align: center; margin-bottom: 0px; margin-top: 30px; font-size: 65%" class="col-sm-6">
<p>Apache ActiveMQ, ActiveMQ, ActiveMQ Artemis, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. Copyright &copy; 2019, The Apache Software Foundation. Licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>.</p>
</div>
<div class="col-sm-3">
<div >
<a href="https://www.apache.org"><img class="float-right" style="margin-top: 10px; max-height: 80px" src="/assets/img/apache-logo-small.png"/></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>