【发布时间】:2015-04-04 14:30:31
【问题描述】:
我正在使用具有两条路线的基于 xml 的骆驼上下文。 Route1 从我的本地 activeMQ 中的队列中读取,Route2 由骆驼计时器组件启动,并且没有对 activeMQ 的引用。
启动 activeMQ 后,我启动了我的骆驼应用程序,两条路由都运行良好。但是,当 activeMQ 停止时,两条路由都会停止工作。
既然 Route2 与 activeMQ 没有任何连接,它不应该继续工作吗?我也尝试在两个骆驼上下文中定义 2 条路线,但它没有解决问题。你能帮帮我吗?
<?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&period=5000"/>
<process ref="testProcessor"/>
</route>
</camelContext>
</beans>
【问题讨论】:
-
你有什么例外吗?
-
不,我没有看到任何异常。
-
我建议将 org.apache.camel 设置为 DEBUG 并查看它记录的内容
标签: apache-camel activemq