blob: 7a5ed9a4de8ec2ca6d2afa5813778bbde17c8b15 [file] [log] [blame]
<div class="wiki-content maincontent"><h3>The Discovery Transport</h3>
<p>The Discovery transport works just like the <link><page ri:content-title="Failover Transport Reference"></page><link-body>Failover</link-body></link> transport, except that it uses a discovery agent to locate the list of uri to connect to. The Discovery transport is also used by the <link><page ri:content-title="Fanout Transport Reference"></page><link-body>Fanout</link-body></link> transport for discovering brokers to send a fanout message to.</p>
<h4>Configuration Syntax</h4>
<p><strong>discovery:(discoveryAgentURI)?transportOptions</strong><br clear="none">
or<br clear="none">
<strong>discovery:discoveryAgentURI</strong></p>
<p>Note that to be able to use <link><page ri:content-title="Discovery"></page></link> to find brokers, the brokers need to have the multicast discovery agent enabled on the broker. </p>
<p>To configure discovery in a Broker you should use the <link><page ri:content-title="Xml Configuration"></page></link>. Here is an <a shape="rect" href="http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/receiver-discovery.xml?view=co">example</a> of using discovery. Its basically something like the following (see the <strong>discoveryUri</strong>)</p>
<structured-macro ac:macro-id="aaf47c6c-4495-4851-b8a2-4d450e232d07" ac:name="code" ac:schema-version="1"><plain-text-body>
&lt;broker name="foo"&gt;
&lt;transportConnectors&gt;
&lt;transportConnector uri="tcp://localhost:0" discoveryUri="multicast://default"/&gt;
&lt;/transportConnectors&gt;
...
&lt;/broker&gt;
</plain-text-body></structured-macro>
<h5>Transport Options</h5>
<table><tbody><tr><th colspan="1" rowspan="1"><p>Option Name</p></th><th colspan="1" rowspan="1"><p>Default Value</p></th><th colspan="1" rowspan="1"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1"><p>reconnectDelay</p></td><td colspan="1" rowspan="1"><p>10</p></td><td colspan="1" rowspan="1"><p>How long to wait for discovery</p></td></tr><tr><td colspan="1" rowspan="1"><p>initialReconnectDelay</p></td><td colspan="1" rowspan="1"><p>10</p></td><td colspan="1" rowspan="1"><p>How long to wait before the first reconnect attempt to a discovered url</p></td></tr><tr><td colspan="1" rowspan="1"><p>maxReconnectDelay</p></td><td colspan="1" rowspan="1"><p>30000</p></td><td colspan="1" rowspan="1"><p>The maximum amount of time we ever wait between reconnect attempts</p></td></tr><tr><td colspan="1" rowspan="1"><p>useExponentialBackOff</p></td><td colspan="1" rowspan="1"><p>true</p></td><td colspan="1" rowspan="1"><p>Should an exponential backoff be used btween reconnect attempts</p></td></tr><tr><td colspan="1" rowspan="1"><p>backOffMultiplier</p></td><td colspan="1" rowspan="1"><p>2</p></td><td colspan="1" rowspan="1"><p>The exponent used in the exponential backoff attempts</p></td></tr><tr><td colspan="1" rowspan="1"><p>maxReconnectAttempts</p></td><td colspan="1" rowspan="1"><p>0</p></td><td colspan="1" rowspan="1"><p>If not 0, then this is the maximum number of reconnect attempts before an error is sent back to the client</p></td></tr><tr><td colspan="1" rowspan="1"><p>group</p></td><td colspan="1" rowspan="1"><p>default</p></td><td colspan="1" rowspan="1"><p> an identifier for the group to partition multi cast traffic among collaborating peers; the group forms part of the shared identity of a discovery datagram (since 5.2) </p></td></tr></tbody></table>
<h5>Example URI</h5>
<structured-macro ac:macro-id="9b5b8676-087a-4fb5-a1a5-b5fa176682fc" ac:name="noformat" ac:schema-version="1"><plain-text-body>
discovery:(multicast://default)?initialReconnectDelay=100
</plain-text-body></structured-macro>
<structured-macro ac:macro-id="a04821a9-8498-4d06-a5e0-f047d1b800e3" ac:name="info" ac:schema-version="1"><parameter ac:name="title">Applying parameters to discovered transports</parameter><rich-text-body>
<p>From 5.4, transport parameters in the URI will also be applied to discovered transports if they are prefixed with <code>discovered.</code>; For example, adding the <code>discovered.connectionTimeout</code> parameter to the URI will apply the parameter to every discovered <link><page ri:content-title="TCP Transport Reference"></page><link-body>TCP</link-body></link> transport, even though this parameter is not a Discovery transport option.</p></rich-text-body></structured-macro></div>