mq在A机器上,同时想启动B机器一起来监听,
A 机器上,spring配置:
<bean id="targetConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://127.0.0.1:61616"/> </bean>
B机器上,spring配置:
<bean id="targetConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://A机器IP:61616"/> </bean>
但是测试,mq的队列
Number Of Consumers
,只有A,没有B,测试B取不到quene
经过查询,需要修改mq的配置 activemq.xml。
<!-- <transportConnectors> DOS protection, limit concurrent connections to 1000 and frame size to 100MB <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> </transportConnectors> <transportConnectors> <transportConnector uri="tcp://localhost:61616" discoveryUri="multicast://default"/> </transportConnectors> --> <transportConnectors> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/> </transportConnectors>
关键就是这个ip
tcp://0.0.0.0:61616
重启mq,测试通过
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/13694.html