2
基本上,我有兩個運行在不同機器上的MQ(ubuntu)。 我需要他們能夠相互溝通。如何連接到在另一臺計算機上運行的ActiveMQ代理(stomp協議,activemessaging)?
我有我的broker.yml,在機器A上,像這樣;
發展:
adapter: stomp
login: ""
passcode: ""
host: localhost
port: 61613
reliable: true
reconnectDelay: 5
foo:
adapter: stomp
login: ""
passcode: ""
host: --IP of machine B here--
port: 61613
reliable: true
reconnectDelay: 5
測試:
adapter: stomp
login: ""
passcode: ""
host: localhost
port: 61613
reliable: true
reconnectDelay: 5
foo:
adapter: stomp
login: ""
passcode: ""
host: --IP of machine B here--
port: 61613
reliable: true
reconnectDelay: 5
生產:
adapter: stomp
login: ""
passcode: ""
host: localhost
port: 61613
reliable: true
reconnectDelay: 5
foo:
adapter: stomp
login: ""
passcode: ""
host: --IP of machine B here--
port: 61613
reliable: true
reconnectDelay: 5
和機器B這樣broker.yml;
發展:
adapter: stomp
login: ""
passcode: ""
host: localhost
port: 61613
reliable: true
reconnectDelay: 5
測試:
adapter: stomp
login: ""
passcode: ""
host: localhost
port: 61613
reliable: true
reconnectDelay: 5
生產:
adapter: stomp
login: ""
passcode: ""
host: localhost
port: 61613
reliable: true
reconnectDelay: 5
如何配置Apache的ActiveMQ的/ conf目錄/ activemq.xml中,這樣我可以讓機傳遞消息給機器B.
現在,我的activemq.xml中看起來是這樣的:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.base}/conf/credentials.properties</value>
</property>
</bean>
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.base}/data" destroyApplicationContextOnStop="true">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb">
<pendingSubscriberPolicy>
<vmCursor />
</pendingSubscriberPolicy>
</policyEntry>
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<persistenceAdapter>
<kahaDB directory="${activemq.base}/data/kahadb"/>
</persistenceAdapter>
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
<transportConnector uri="stomp://localhost:61613"/>
</transportConnectors>
</broker>
<import resource="jetty.xml"/>
提前感謝!