客户端到broker的连接称为transportConnector。
conf下的activemq.xml
<networkConnectors>
<networkConnector name="local network"
uri="static://(tcp://192.168.25.128:61616,tcp://192.168.25.128:61716)"/>
</networkConnectors>
到conf下的activemq.xml中去添加。默认的情况,是没有这个配置的。
重启activemq
发送端:
接收端:
发送到61616,但是,从61716收到了消息,这就是桥接模式的效果。
decreaseNetworkConsumerPriority:
BrokerB可以看成BrokerA的一个特殊的消费者。BrokerB会比BrokerA消费更多的消息。
conduitSubscriptions:
假设,BrokerA有1个consumer,BrokerB有2个consumer。负载均衡的时候,conduitSubscriptions=false时,BrokerA得到1/3的消息,BrokerB得到2/3的消息。conduitSubscriptions=true时,BrokerB的2个consumer会被当做一个处理。那么,BrokerA得到1/2的消息,BrokerB得到1/2的消息。
dynamicallyIncludeDestinations:
这个配置是决定哪些消息会从brokerA赚到brokerB。
duplex:
重启activemq,测试。
发现,配置了duplex="true", 发送给BrokerB的消息可以从BrokerA接收。没配置的话,就不行。