2012-03-15 149 views
0

我試圖配置Apache ServiceMix的實施以下網絡拓撲結構:與服務組合路由隊列

enter image description here

我的服務組合,駱駝,的ActiveMQ等東西,主要是很新我試圖解決的問題是將消息從DC1.ActiveMqBroker的輸出隊列路由到DC2.ActiveMqBroker的輸入隊列。

我相信這應該很容易。有人能指點我的好文章,或者寫一些粗略的配置(在Spring/Blueprint中,無所謂)嗎?

UPDATE:

對不起,長文本,但我沒有看到其他的方式告訴我的問題。

我的示例配置:

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="dc2" dataDirectory="${karaf.data}/activemq/dc2" useShutdownHook="false"> 
    <destinationPolicy> 
     <policyMap> 
      <policyEntries> 
       <policyEntry queue="input" producerFlowControl="true" memoryLimit="1mb"/> 
       <policyEntry queue="output" producerFlowControl="true" memoryLimit="1mb"/> 
      </policyEntries> 
     </policyMap> 
    </destinationPolicy> 
    <managementContext> 
     <managementContext createConnector="false"/> 
    </managementContext> 
    <persistenceAdapter> 
     <kahaDB directory="${karaf.data}/activemq/dc2/kahadb"/> 
    </persistenceAdapter> 
    <transportConnectors> 
     <transportConnector name="openwire" uri="tcp://localhost:61619"/> 
    </transportConnectors> 
</broker> 

<bean id="dc1activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
    <property name="brokerURL" value="tcp://localhost:61619" /> 
</bean> 

<bean id="dc2activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
    <property name="brokerURL" value="tcp://localhost:61618" /> 
</bean> 

<camelContext xmlns="http://camel.apache.org/schema/blueprint"> 
    <route> 
     <from uri="dc1activemq:queue:output"/> 
     <log message="Took message from dc1 to dc2"/> 
     <to uri="dc2activemq:queue:input"/> 
    </route> 
</camelContext> 

而且我不斷收到以下錯誤:

08:06:40,739 | INFO | rint Extender: 3 | Activator      | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | Found 1 @Converter classes to load 
08:06:40,740 | INFO | rint Extender: 3 | Activator      | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | Found 1 @Converter classes to load 
08:06:40,741 | INFO | rint Extender: 3 | Activator      | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | Found 1 @Converter classes to load 
08:06:40,741 | INFO | rint Extender: 3 | Activator      | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | Found 2 @Converter classes to load 
08:06:40,749 | INFO | rint Extender: 3 | Activator      | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | Found 13 @Converter classes to load 
08:06:40,754 | INFO | rint Extender: 3 | BlueprintCamelContext   | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | JMX enabled. Using ManagedManagementStrategy. 
08:06:40,758 | INFO | rint Extender: 3 | BlueprintCamelContext   | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | Apache Camel 2.6.0 (CamelContext: 211-camel-165) is starting 
08:06:42,364 | INFO | rint Extender: 3 | BlueprintCamelContext   | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | Route: route55 started and consuming from: Endpoint[dc1activemq://queue:output] 
08:06:42,364 | INFO | rint Extender: 3 | BlueprintCamelContext   | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | Total 1 routes, of which 1 is started. 
08:06:42,365 | INFO | rint Extender: 3 | BlueprintCamelContext   | ?         ? | 68 - or 
g.apache.camel.camel-core - 2.6.0 | Apache Camel 2.6.0 (CamelContext: 211-camel-165) started in 1.606 seconds 
08:06:48,379 | WARN | tenerContainer-1 | DefaultMessageListenerContainer | ?         ? | 77 - or 
g.springframework.jms - 3.0.5.RELEASE | Could not refresh JMS Connection for destination 'output' - retrying in 5000 ms. Cau 
se: Could not connect to broker URL: tcp://localhost:61619. Reason: java.net.ConnectException: Connection refused: connect 
08:06:54,381 | WARN | tenerContainer-1 | DefaultMessageListenerContainer | ?         ? | 77 - or 
g.springframework.jms - 3.0.5.RELEASE | Could not refresh JMS Connection for destination 'output' - retrying in 5000 ms. Cau 
se: Could not connect to broker URL: tcp://localhost:61619. Reason: java.net.ConnectException: Connection refused: connect 

回答

1

我做,你有駱駝是如何在ServiceMix的啓動手柄,並有一個假設一些(至少)概念驗證路線..如果沒有,start there。另外假設您知道2個消息代理的URL,並且已經設置好了。

鑑於這種情況,一種解決方案是註冊兩個ActiveMQComponents:

<bean id="dc1activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
    <property name="brokerURL" value="tcp://DC1BrokerLocation:12345" /> 
</bean> 

<bean id="dc2activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
    <property name="brokerURL" value="tcp://DC2BrokerLocation:12345" /> 
</bean> 

,然後在駱駝背景:

<camelContext xmlns="http://camel.apache.org/schema/blueprint"> 
    <route> 
     <from uri="dc1activemq:queue:whateverTheOutQueueIsCalled"/> 
     <log message="Took message from dc1 to dc2"/> 
     <to uri="dc2activemq:queue:whateverTheInQueueIsCalled"/> 
    </route> 
    <route> 
     <from uri="dc2activemq:queue:whateverTheOutQueueIsCalled"/> 
     <log message="Took message from dc2 to dc1"/> 
     <to uri="dc1activemq:queue:whateverTheInQueueIsCalled"/> 
    </route> 
<camelContext> 
+0

感謝羅伊,我想你的解決方案之前(我想我這樣做錯誤)。但是你確認我的方式正確。請在更新後的問題中查看更精確的錯誤。 – Pashec 2012-03-15 12:47:16

+0

嗨Pashec,不幸的是我們開始進入一個我不太熟悉的地方 - 使用元素設置Active MQ。從錯誤中可以明顯看出,您的經紀人沒有運行,但我不知道爲什麼。如果你無法弄清楚它可能值得創建另一個questino – 2012-03-15 16:18:24