| <div class="wiki-content maincontent"><p>Discovery refers to either a client (producer or consumer) establishing a 'transport connector' to the broker or a broker establishing 'network connector' to another broker without explicit static configuration of broker (IP or hostname).</p> |
| |
| <p>The scheme 'multicast' refers to either listening for or advertising discovery events on a multicast address. zeroconf is similar to multicast, except for protocol specific to Apple's Rendezvous (bonjour).</p> |
| |
| <h3>Broker</h3> |
| |
| <structured-macro ac:macro-id="22ee5d65-5851-470c-a809-e0b90e776c32" ac:name="code" ac:schema-version="1"><plain-text-body> |
| <networkConnectors> |
| <networkConnector name="default" uri="multicast://default"/> |
| </networkConnectors> |
| </plain-text-body></structured-macro> |
| |
| <p>The above configuration in the broker xml file will make it automatically establish network connectors to other brokers that advertise themselves on the multicast address: when this broker gets a discovery event from another broker, the event has information that enables it to establish network connector to that broker.</p> |
| |
| <p>Self-advertisement is facilitated by the following config:</p> |
| |
| |
| <structured-macro ac:macro-id="c21df2d5-ec0c-46d7-958e-1e248b26908d" ac:name="code" ac:schema-version="1"><plain-text-body> |
| <transportConnectors> |
| <transportConnector name="default" uri="tcp://localhost:61616" discoveryUri="multicast://default"/> |
| </transportConnectors> |
| </plain-text-body></structured-macro> |
| |
| <h3>Client</h3> |
| |
| <p>An example usage of discovery on the client side (using the transport 'discovery' that uses discovery agent) ...</p> |
| |
| |
| <structured-macro ac:macro-id="bd132e4e-2190-4c96-b5cc-b400f1ee251f" ac:name="code" ac:schema-version="1"><plain-text-body> |
| <transportConnectors> |
| <transportConnector name="default" uri="discovery:(multicast://default)"/> |
| </transportConnectors> |
| </plain-text-body></structured-macro> |
| |
| <p>ps: discovery (which is a confusing name) is just like a 'reliable' transport such as <link><page ri:content-title="Failover Transport Reference"></page><link-body>failover</link-body></link>. If it is unable to connect to a broker, it will try another broker (assuming it<br clear="none"> |
| heard its advertisement over multicast).</p></div> |
| |