blob: 3f31c292c2ef1070ecd9e3f8f35d0f81ee2de068 [file] [log] [blame]
<div class="wiki-content maincontent"><h2 id="Discovery-DiscoveryAgents">Discovery Agents</h2><p>ActiveMQ uses an abstraction called a <a shape="rect" class="external-link" href="http://actievmq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/transport/discovery/DiscoveryAgent.html">Discovery Agent</a> to detect remote services such as remote brokers. We can use discovery for JMS clients to auto-detect a Message Broker to connect to, or to provide <a shape="rect" href="networks-of-brokers.html">Networks of Brokers</a></p><p>There are currently two kinds of discovery agent.</p><h3 id="Discovery-Multicast">Multicast</h3><p>The Discovery transport uses our own Multicast based discovery agent to locate the list of URIs to connect to.</p><p>For more information see the <a shape="rect" href="discovery-transport-reference.html">Discovery Transport Reference</a>.</p><h3 id="Discovery-Zeroconf">Zeroconf</h3><p><a shape="rect" href="zeroconf.html">ZeroConf</a> is a standard discovery specification that uses UDP / multicast to discovery devices. Its used by Apple's Rendezvous services.<br clear="none"> We use the <a shape="rect" class="external-link" href="http://jmdns.sf.net/" rel="nofollow">jmDNS</a> project to implement the Zeroconf specification to detect services. This means other Zeroconf<br clear="none"> based tools can be used in conjunction with this discovery agent.</p><p>To configure discovery in a Broker you should use the <a shape="rect" href="xml-configuration.html">Xml Configuration</a>. Here is an <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/resources/org/apache/activemq/usecases/receiver-zeroconf.xml?view=co">example</a> of using discovery to create <a shape="rect" href="networks-of-brokers.html">Networks of Brokers</a>.</p><p>If you have one or more brokers running with Zeroconf discovery enabled you can connect to a broker using the brokerURL</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">zeroconf:_activemq_development.
</pre>
</div></div><p>This will use Zeroconf to find an available broker and one will be randomly chosen &amp; things will auto-failover on disconnect if there are several brokers running.</p><h3 id="Discovery-LDAPDiscovery">LDAP Discovery</h3><p>ActiveMQ supports the use of LDAP for discovery of brokers.</p><p>Please see <a shape="rect" href="ldap-broker-discovery-mechanism.html">LDAP Broker Discovery Mechanism</a> for more details.</p><h2 id="Discovery-Tryingoutdiscovery">Trying out discovery</h2><p>If you run the following commands in separate shells you'll have 2 brokers auto-discovering themselves and 2 clients using fixed-URLs</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">maven -o server -Dconfig=src/test/org/activemq/usecases/receiver-zeroconf.xml
maven -o server -Dconfig=src/test/org/activemq/usecases/sender-zeroconf.xml
maven -o consumer -Durl=tcp://localhost:62002
maven -o producer -Durl=tcp://localhost:62001
</pre>
</div></div><p>If you want the clients to use discovery to find brokers, run either of the two 'server' statements above (or both) then run the producer/consumer as follows</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">maven -o consumer -Durl=zeroconf:_activemq.broker.development.
maven -o producer -Durl=zeroconf:_activemq.broker.development.
</pre>
</div></div><p>The transport URL is of the format</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"> zeroconf:&lt;serviceName&gt;
</pre>
</div></div><p>where <em>&lt;serviceName&gt;</em> is the Zeroconf service name; which seems to start with an underscore (_) and must end with a dot (.). So we can use this service name to distinguish development, UAT &amp; production brokers - or group them into domains etc.</p><h2 id="Discovery-DiscoveryandSecurity">Discovery and Security</h2><p>When using auto discovery of brokers an attacker may be able to present itself as a legitimate broker and by this way catch and / or manipulate all messages that run over it.</p><p>Are there security settings in auto discovery to avoid this?</p></div>