带有 AMQP 消费者的骆驼路线在 Eclipse 中运行正常,在 karaf 中挂起

Camel route with AMQP consumer runs ok in Eclipse, hangs in karaf

我正在使用 Camel 2.17.3 和 karaf 4.0.7(也尝试过 4.0.1)。

我有一个 Camel 路由,当 junit 测试启动它时,它在 Eclipse 中 运行 很好,但在部署到 karaf 时挂起。如果我将 amqp: 'from' 组件更改为计时器:路由 运行 在 karaf 中很好。

我在路由生成器中的 AMQP 设置是:

   @Override
    public void configure() throws Exception {

        getContext().addComponent("amqp", AMQPComponent.amqpComponent(String.format("amqp://%s:%s?amqp.saslMechanisms=ANONYMOUS", AMQP_SERVICE_HOST, AMQP_SERVICE_PORT)));

即使这条路线也会挂起 karaf,并且 运行 在 Eclipse 中很好:

 from("amqp:queue:myqueue").routeId("myRoute")
 .log("temp")

在 Karaf 中,当我说 "hang" 时,我观察到这些事情:

2016-10-08 23:46:00,593 | INFO | nsole user karaf | bundle
| 90 - org.apache.aries.spifly.dynamic.bundle - 1.0.1 | Bundle Considered for SPI providers: mis-routes 2016-10-08 23:46:00,593 | INFO | nsole user karaf | bundle | 90 - org.apache.aries.spifly.dynamic.bundle - 1.0.1 | No 'SPI-Provider' Manifest header. Skipping bundle: mis-routes 2016-10-08 23:46:05,595 | INFO | ool-130-thread-1 | OsgiDefaultCamelContext | 56 - org.apache.camel.camel-core - 2.17.3 | Apache Camel 2.17.3 (CamelContext: mis-routes) is starting 2016-10-08 23:46:05,599 | INFO | ool-130-thread-1 | OsgiDefaultCamelContext | 56 - org.apache.camel.camel-core - 2.17.3 | MDC logging is enabled on CamelContext: mis-routes 2016-10-08 23:46:05,601 | INFO | ool-130-thread-1 | ManagedManagementStrategy | 56 - org.apache.camel.camel-core - 2.17.3 | JMX is enabled 2016-10-08 23:46:05,708 | INFO | ool-130-thread-1 | DefaultRuntimeEndpointRegistry | 56 - org.apache.camel.camel-core - 2.17.3 | Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000) 2016-10-08 23:46:05,804 | INFO | ool-130-thread-1 | OsgiDefaultCamelContext | 56 - org.apache.camel.camel-core - 2.17.3 | AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance. 2016-10-08 23:46:05,805 | INFO | ool-130-thread-1 | OsgiDefaultCamelContext | 56 - org.apache.camel.camel-core - 2.17.3 | StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html

任何帮助将不胜感激。谢谢!

原因应该与Camel JIRA中的这个问题有关:https://issues.apache.org/jira/browse/CAMEL-10278

主要问题是 proton-j 0.10 与 qpid-jms-client 版本 0.8 不兼容。我们将依赖项升级到 proton-j 0.12.0,修复程序将在 Camel 2.17.4 版本中提供。

目前可以使用Camel 2.17.4-SNAPSHOT或者升级Camel-Amqp Karaf特性中的依赖