Apache camel activemq不工作时,所有骆驼路由都会停止

Apache camel activemq不工作时,所有骆驼路由都会停止,apache-camel,activemq,Apache Camel,Activemq,我使用的是一个基于xml的camel上下文,它有两条路由。Route1从本地activeMQ中的队列中读取,Route2由骆驼计时器组件启动,并且没有对activeMQ的引用 启动activeMQ后,我启动了camel应用程序,两种路由都运行良好。但是,当activeMQ停止时,两条路由都停止工作 既然Route2和activeMQ没有任何连接,它不应该继续工作吗?我也尝试在两个驼峰上下文中定义这两条路线,但没有解决问题。你能帮我一下吗 <?xml version="1.0" encodi

我使用的是一个基于xml的camel上下文,它有两条路由。Route1从本地activeMQ中的队列中读取,Route2由骆驼计时器组件启动,并且没有对activeMQ的引用

启动activeMQ后,我启动了camel应用程序,两种路由都运行良好。但是,当activeMQ停止时,两条路由都停止工作

既然Route2和activeMQ没有任何连接,它不应该继续工作吗?我也尝试在两个驼峰上下文中定义这两条路线,但没有解决问题。你能帮我一下吗

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
          http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- The ActiveMQ connection factory with specification of the server URL -->
    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL" value="failover://tcp://localhost:61616" />
                <property name="userName" value="admin"/>
                <property name="password" value="admin"/>
            </bean>
        </property>
    </bean>

    <bean id="myApp" class="org.camel.poc.App"/>
    <bean id="testProcessor" class="org.camel.poc.TestProcessor"/>


  <!-- here is Camel configured with a number of routes -->
  <camelContext id="camel1" xmlns="http://camel.apache.org/schema/spring">

    <route id="3">
        <from uri="activemq:queue:testMQ"/>
        <!--process ref="myApp"/-->
        <to uri="activemq:queue:testMQDestination2"/>
    </route>

  </camelContext>

  <camelContext id="camel2" xmlns="http://camel.apache.org/schema/spring">
    <route id="2">
        <from uri="timer://foo?fixedRate=true&amp;period=5000"/>
        <process ref="testProcessor"/>
    </route>
</camelContext>
</beans>

使用
asyncStartListener
选项并将其设置为
true
以启动ActiveMQ async,这将允许启动其他路由和Camel。有关详细信息,请参见文档:



您是否有任何异常?没有,我没有看到任何异常。我建议将org.apache.camel设置为调试并查看日志。我对AsyncListener上的文档有疑问。这似乎意味着,过了一段时间,如果您试图连接的端点仍然没有启动,您将不得不通过JMX接口手动重新启动路由。此外,通过查看文档,似乎没有一种方法可以设置连接超时时间间隔。有没有一种方法可以控制路由在放弃之前尝试连接多长时间并记录异常(如果发生)?
<from uri="activemq:queue:testMQ?asyncStartListener=true"/>