我对骆驼的溃败遇到了一些问题。这是我的配置文件,很简单:
<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&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]]]]]
任何想法?我在哪里可以获得 Camel + RabbitMQ 的示例或教程?
- - 更新 - -
按照以下评论的建议,我修复了配置,并且已经完成了一小步。现在它似乎能够连接到队列但是,如果我尝试写我得到“camelContext must be specified”异常
<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>
谢谢,
安德里亚