ActiveMQ broker network, static discovery and dynamic discovery

After downloading the activemq archive and decompressing it, there are various sample configuration files in the conf directory. The red lines indicate the configurations of static discovery and dynamic discovery.

 

1. Static configuration

Start three brokers, the ports are 61616, 61618, 61620, and the configuration is as follows:

<networkConnectors></networkConnectors>
<transportConnectors>
    <transportConnector name="openwire" uri="tcp://localhost:61616"/>
</transportConnectors>
<networkConnectors>
    <networkConnector uri="static:(tcp://localhost:61616)" duplex="true"/>
</networkConnectors>
<transportConnectors>
    <transportConnector name="openwire" uri="tcp://localhost:61618"/>
</transportConnectors>
<networkConnectors>
    <networkConnector uri="static:(tcp://localhost:61616,tcp://localhost:61618)" duplex="true"/>
</networkConnectors>
<transportConnectors>
    <transportConnector name="openwire" uri="tcp://localhost:61620"/>
</transportConnectors>

Three brokers form a network. When the producer sends a message to broker: 61616, the consumer of broker: 61618 can receive the message. The message flows from broker: 61616 to broker: 61618. The underlying principle is that broker: 61618 is a consumer of broker: 61616.

2. Dynamic configuration

Similarly, start three brokers with ports 61616, 61618, and 61620, and the configuration is as follows:

<networkConnectors>
    <networkConnector uri="multicast://default"/>
</networkConnectors>
    <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" discoveryUri="multicast://default" />
</transportConnectors>
<networkConnectors>
    <networkConnector uri="multicast://default"/>
</networkConnectors>
<transportConnectors>
    <transportConnector name="openwire" uri="tcp://0.0.0.0:61618" discoveryUri="multicast://default" />
</transportConnectors>
<networkConnectors>
    <networkConnector uri="multicast://default"/>
</networkConnectors>
<transportConnectors>
    <transportConnector name="openwire" uri="tcp://0.0.0.0:61620" discoveryUri="multicast://default" />
</transportConnectors>

The three brokers dynamically form a network.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324638734&siteId=291194637