我想在Apache駱駝使用春天DSL運行一個簡單的應用程序。 這裏是我的春天-config.xml中阿帕奇駱駝春天DSL
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://localhost" />
</bean>
</property>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="file:src/data?noop=true" />
<process ref="downloadLogger" />
<to uri="jms:incomingOrders" />
</route>
</camelContext>
<bean id="downloadLogger" class="com.test.eip.camel.DownloadLogger"></bean>
這裏是我的測試Java類:
public class CamelSpringTest {
public static void main(String[] args) throws Exception {
ApplicationContext appContext = new ClassPathXmlApplicationContext("spring-config.xml");
CamelContext camelContext = SpringCamelContext.springCamelContext(appContext, false);
try {
System.out.println("Hello");
camelContext.start();
} finally {
System.out.println("Hello2");
camelContext.stop();
}
}
}
我可以看到大家好,hello2在我的控制檯,但我的文件沒有被移動。我想我在創建駱駝上下文時做錯了什麼。能否請你幫忙?我是否需要明確添加路由到camelContext?