我正在尝试将AMQP队列用作路由的开始和结束。我无法按照http://camel.apache.org/amqp.html
上的示例来解决此问题有人可以指出我正确的方向吗?
我正在karaf的蓝图容器中部署它。
我的设置是:
<bean id="amqpConnectionFactory"
class="org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl"
factory-method="createFromURL">
<argument value="${IssBroker.url}" />
</bean>
<bean id="amqpConnection"
class="org.apache.camel.component.jms.JmsComponent" >
<property name="connectionFactory" ref="amqpConnectionFactory"/>
</bean>
...
<route>
<from uri="amqp:{{IssFrom.queue}}"/>
<process ref="issPreprocessor"/>
<unmarshal ref="IssRequest"/>
<process ref="webServiceProcessor"/>
<to uri="webService"/>
<process ref="packageWebServiceReplyForIss"/>
<to uri="amqp:{{IssTo.queue}}"/>
</route>
当我在卡拉夫开始时,我得到:
2015-10-08 13:34:00,968 | ERROR | nsole user karaf | BlueprintCamelContext | 109 - org.apache.camel.camel-blueprint - 2.15.3 | Error occurred during starting Camel: CamelContext(myCamelContext) due connectionFactory must be specified
java.lang.IllegalArgumentException: connectionFactory must be specified
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:293)
at org.apache.camel.component.jms.JmsConfiguration.createConnectionFactory(JmsConfiguration.java:1131)
at org.apache.camel.component.jms.JmsConfiguration.getConnectionFactory(JmsConfiguration.java:485)
at org.apache.camel.component.jms.JmsConfiguration.createListenerConnectionFactory(JmsConfiguration.java:1140)
at org.apache.camel.component.jms.JmsConfiguration.getListenerConnectionFactory(JmsConfiguration.java:504)
at org.apache.camel.component.jms.JmsConfiguration.configureMessageListenerContainer(JmsConfiguration.java:967)
at org.apache.camel.component.jms.JmsConfiguration.createMessageListenerContainer(JmsConfiguration.java:448)
at org.apache.camel.component.jms.JmsEndpoint.createMessageListenerContainer(JmsEndpoint.java:184)
at org.apache.camel.component.jms.JmsEndpoint.createConsumer(JmsEndpoint.java:179)
at org.apache.camel.component.jms.JmsEndpoint.createConsumer(JmsEndpoint.java:71)
...
答案 0 :(得分:1)
似乎你的amqpConnectionFactory bean结尾为null,其中一个原因是你的IssBroker.url属性为null或格式错误。你有没有在你的karaf容器中覆盖这个属性?
您已经为您的JmsComponent提供了id amqpConnection,然后使用amqp:${{IssFrom.queue}}
将id更改为amqp或将路由中使用的组件更改为amqpConnection:${{IssFrom.queue}}