2013-01-07 9 views
0

我遇到了一些與駱駝路由的問題。這是我的配置文件,很簡單:amqp和駱駝錯誤:路由沒有輸入

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

<camel:camelContext xmlns="http://camel.apache.org/schema/spring"> 

    <jmxAgent id="agent" createConnector="false" disabled="true"/> 

    <camel:route> 
     <route> 
      <from uri="activemq:hello?destination.consumer.exclusive=true&amp;destination.consumer.prefetchSize=50"/> 
      <to uri="stream:out"/> 
     </route> 
    </camel:route> 
</camel:camelContext> 

在這種情況下,我使用RabbitMQ,hello是隊列名稱。

運行它,我得到這個錯誤信息:

Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Route has no inputs: Route[[] -> [Route[[From[activemq:hello?destination.consumer.exclusive=true&destination.consumer.prefetchSize=50]] -> [To[stream:out]]]]] 

任何想法?我在哪裏可以獲得駱駝+ RabbitMQ的樣本或教程?

---修訂---

繼下面的評論的建議,我固定的配置和一點點領先一步已經完成。現在,似乎能夠連接到隊列,但是,如果我嘗試寫我得到「camelContext必須指定」異常

<bean id="messageConverter" class="amqp.spring.converter.XStreamConverter"/> 

<rabbit:connection-factory id="connectionFactory" host="10.211.55.20" port="5672" /> 
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" message-converter="messageConverter" exchange="amq.fanout" /> 
<rabbit:admin connection-factory="connectionFactory"/> 
<rabbit:queue name="hello" /> 

<camel:camelContext xmlns="http://camel.apache.org/schema/spring"> 
    <camel:route> 
     <camel:from uri="file:src/data?noop=true" /> 
     <camel:log message="Log!"/> 
     <camel:to uri="spring-amqp:amq.fanout:hello"/> 
    </camel:route> 
</camel:camelContext> 

感謝,
安德烈

+0

只是一個簡單的問題。你在談論駱駝+ RabbitMQ還是Camel + ActiveMQ? –

+0

我正在嘗試用戶Camel + RabbitMQ –

+0

Camel中的ActiveMQ組件無法用於連接到RabbitMQ,因爲它們說不同的協議。對於RabbitMQ,您應該使用AMQP組件。 –

回答

0

有兩個錯誤。首先,XML似乎航線上失蹤的命名空間:

<camel:route> 
    <route> 
     <from uri="activemq:hello?destination.consumer.exclusive=true&amp;destination.consumer.prefetchSize=50"/> 
     <to uri="stream:out"/> 
    </route> 

應該是:

<camel:route> 
    <camel:route> 
     <camel:from uri="activemq:hello?destination.consumer.exclusive=true&amp;destination.consumer.prefetchSize=50"/> 
     <camel:to uri="stream:out"/> 
    </camel:route> 

然後,RabbitMQ的是此刻不和ActiveMQ真正兼容。 ActiveMQ 5.8版似乎支持RabbitMQ使用的AMQP協議,但是如果它將在Camel組件中得到支持,或者它將與RabbitMQ兼容是另一個問題。我不知道。

駱駝也有一個AMQP組件。它使用的是Apache QPID客戶端,我沒有任何運氣用RabbitMQ來運行它。如果你深入使用某些特定的版本等(http://www.rabbitmq.com/interoperability.html),它可能會在某種程度上起作用。

0

我有同樣的問題。事實證明,我已經堆積了route。 所以,而不必

<camel:route> 
    <route> 
     <from uri="activemq:hello?destination.consumer.exclusive=true&amp;destination.consumer.prefetchSize=50"/> 
     <to uri="stream:out"/> 
    </route> 

只是跳過封閉<route>