您好,登錄后才能下訂單哦!
<networkConnectors>
<networkConnector uri="masterslave:(tcp://host1:61616,tcp://host2:61616,tcp://..)"/>
</networkConnectors>
<networkConnectors>
<networkConnector uri="static:(tcp://host1:61616,tcp://host2:61617,tcp://..)"/>
</networkConnectors>
表示當前local broker與remote broker(61616/61617)建立的單向網絡連接。即local broker可以將消息傳遞給remote broker,但反過來就不行。duplex="true" 屬性配置可以開啟雙向通信。
<networkConnectors>
<networkConnector uri="multicast://default"/>
</networkConnectors>
<transportConnector uri="tcp://localhost:0" discoveryUri="multicast://default"/>
組播發現會自動發現同網絡中的broker并進行連接通信。注意:必須是同網絡中。
在實際的配置很少這樣配置,因為無法保證哪些brokers建立了連接。對于master-slave配置也不是很好。
<dynamicallyIncludedDestinations>
<queue physicalName="include.test.foo"/>
<topic physicalName="include.test.bar"/>
</dynamicallyIncludedDestinations>
當networkConnector中連接的broker有customers時,那么對應的destinations才會傳遞到對應的broker。否則,不傳遞。這中方式對于point-to-point的方式就比較合適。
<staticallyIncludedDestinations>
<queue physicalName="always.include.queue"/>
<topic physicalName="always.include.topic"/>
</staticallyIncludedDestinations>
不管networkConnector中連接的broker有無customers,都會講消息發送到每個broker去。這種方式比較適合topic的消息方式。
<excludedDestinations>
<queue physicalName="exclude.test.foo"/>
<topic physicalName="exclude.test.bar"/>
</excludedDestinations>
networkConnector中指定某些detination不會發送到remote brokers.
uri="static:(tcp://host1:61616,tcp://host2:61616)?maxReconnectDelay=5000&useExponentialBackOff=false"
initialReconnectDelay:重連的時間間隔。
maxReconnectDelay:最大重連時間。即initialReconnectDelay次數
useExponentialBackOff:一次連接失敗,后面的重連時間是否依次遞增。
backOffMultiplier:當useExponentialBackOff=true,重連時間的間隔的倍數,即initialReconnectDelaybackOffMultiplier
name:連接名稱,多個時必須唯一。
dynamicOnly:
decreaseNetworkConsumerPriority:
networkTTL:
messageTTL:
consumerTTL:
conduitSubscriptions:管道訂閱。即一個broker有多個customers,也只會認為是一個customer.
excludedDestinations:
dynamicallyIncludedDestinations:
useVirtualDestSubs:
staticallyIncludedDestinations:
duplex:是否開啟雙工通信
prefetchSize:
suppressDuplicateQueueSubscriptions:
bridgeTempDestinations:
alwaysSyncSend:
staticBridge:靜態連接橋。與staticallyIncludedDestinations聯合使用
userName:networkConnector連接用戶名
password:networkConnector連接密碼
broker-master
<networkConnectors>
<networkConnector name="connector_master_slave" uri="static:(tcp://localhost:61618,tcp://localhost:61619)"
userName="admin" password="admin123"/>
<networkConnector name="connector_brokers" uri="static:(tcp://localhost:61620,tcp://localhost:61621)" userName="admin" password="admin123">
<dynamicallyIncludedDestinations>
<queue physicalName=">"/>
</dynamicallyIncludedDestinations>
<staticallyIncludedDestinations>
<topic physicalName=">"/>
</staticallyIncludedDestinations>
</networkConnector>
</networkConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61617?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
broker-slave01
<networkConnectors>
<networkConnector name="connector_master_slave" uri="static:(tcp://localhost:61617,tcp://localhost:61619)" userName="admin" password="admin123"/>
<networkConnector name="connector_brokers" uri="static:(tcp://localhost:61620,tcp://localhost:61621)" userName="admin" password="admin123">
<dynamicallyIncludedDestinations>
<queue physicalName=">"/>
</dynamicallyIncludedDestinations>
<staticallyIncludedDestinations>
<topic physicalName=">"/>
</staticallyIncludedDestinations>
</networkConnector>
</networkConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61618?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
broker-slave02
<networkConnectors>
<networkConnector name="connector_master_slave"
uri="static:(tcp://localhost:61617,tcp://localhost:61618)" userName="admin" password="admin123"/>
<networkConnector name="connector_brokers" uri="static:(tcp://localhost:61620,tcp://localhost:61621)" userName="admin" password="admin123">
<dynamicallyIncludedDestinations>
<queue physicalName=">"/>
</dynamicallyIncludedDestinations>
<staticallyIncludedDestinations>
<topic physicalName=">"/>
</staticallyIncludedDestinations>
</networkConnector>
</networkConnectors>
broker-cluster01
<networkConnectors>
<networkConnector uri="static:(tcp://localhost:61621)" duplex="false" name="connector_broker_normal" userName="admin" password="admin123">
<dynamicallyIncludedDestinations>
<queue physicalName=">" />
<topic physicalName=">" />
</dynamicallyIncludedDestinations>
</networkConnector>
</networkConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61620?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
broker-cluster02
<networkConnectors>
<networkConnector uri="static:(tcp://localhost:61620)" duplex="false" name="connector_broker_normal" userName="admin" password="admin123">
<dynamicallyIncludedDestinations>
<queue physicalName=">" />
<topic physicalName=">" />
</dynamicallyIncludedDestinations>
</networkConnector>
</networkConnectors>
<transportConnector name="openwire"uri="tcp://0.0.0.0:61621?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
brokers的安全配置
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="${activemq.username}" password="${activemq.password}" groups="admins"/>
</users>
</simpleAuthenticationPlugin>
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
<authorizationEntry topic=">" read="admins" write="admins" admin="admins"/>
</authorizationEntries>
<tempDestinationAuthorizationEntry>
<tempDestinationAuthorizationEntry read="admins" write="admins" admin="admins"/>
</tempDestinationAuthorizationEntry>
</authorizationMap>
</map>
</authorizationPlugin>
</plugins>
參考文檔:
http://activemq.apache.org/networks-of-brokers.html
http://shift-alt-ctrl.iteye.com/blog/2070531
https://www.cnblogs.com/shihaiming/p/6018916.html
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。