我正在使用ServiceMix以及Apache camel和Qpid库连接到远程节点来获取JMS队列。
我的Bean配置是::
<bean id="amqp" class="org.apache.camel.component.amqp.AMQPComponent">
<property name="connectionFactory">
<bean class="org.apache.qpid.jms.JmsConnectionFactory">
<property name="remoteURI" value="amqp://esesslxjks.se:9443" />
</bean>
</property>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<!-- Master Data Queue -->
<route>
<from uri="amqp:queue:///CS_output" />
<log message="Copying o the output directory"/>
<to uri="amqp:queue:///CS_input" />
</route>
使用这个bean我启动我的应用程序并看到一些积极的回应::
| DEBUG | mix-7.0.0/deploy | JmsProducer | 43 - org.apache.camel.camel-core - 2.16.4 | Starting producer: Producer[amqp://queue:///CSDP_input]
| DEBUG | mix-7.0.0/deploy | JmsConsumer | 43 - org.apache.camel.camel-core - 2.16.4 | Starting consumer: Consumer[amqp://queue:///CSDP_output]
| DEBUG | mix-7.0.0/deploy | BlueprintCamelContext | 43 - org.apache.camel.camel-core - 2.16.4 | Route: route1 >>> EventDrivenConsumerRoute[Endpoint[amqp://queue:///CS_output] -> Pipeline[[Channel[Log(route1)[Copying o the output directory]], Channel[sendTo(Endpoint[amqp://queue:///CS_input])]]]]
| DEBUG | mix-7.0.0/deploy | faultJmsMessageListenerContainer | 154 - org.apache.servicemix.bundles.spring-jms - 3.2.17.RELEASE_1 | Established shared JMS Connection
但后来我得到了以下ERROR ::
| DEBUG | esesslxjks.se:9443] | AmqpProvider | 226 - qpid-jms-client.jar - 0.0.0 | Transport connection remotely closed
| DEBUG | esesslxjks.se:9443] | JmsConnection | 226 - qpid-jms-client.jar - 0.0.0 | Async exception with no exception listener: java.io.IOException: Connection remotely closed.
java.io.IOException: Connection remotely closed.
at org.apache.qpid.jms.provider.amqp.AmqpProvider$18.run(AmqpProvider.java:727)[226:qpid-jms-client.jar:0.0.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
我目前还不知道为什么会发生这种情况?我可以做哪些其他可能的调试?强烈推荐任何指针。
答案 0 :(得分:0)
我没有像你的例子一样运行你的弹簧骆驼的用例。但是我遇到了你在我的一次单元测试中遇到的完全相同的堆栈跟踪。我发现的是,在我明确尝试关闭我的代理实例后,我的qpid jms客户端也会尝试关闭连接。因此抛出那个例外。我知道我的用例并不像你的那样,但我希望这有点帮助。祝好运。
答案 1 :(得分:0)
在remoteURI属性上,使用amqps协议而不是amqp。
ServiceBus将拒绝使用它,因为它使用了不受支持的协议。
<bean id="amqp" class="org.apache.camel.component.amqp.AMQPComponent">
<property name="connectionFactory">
<bean class="org.apache.qpid.jms.JmsConnectionFactory">
<property name="remoteURI" value="amqps://esesslxjks.se:9443" />
</bean>
</property>
</bean>