繁体   English   中英

如何在apache骆驼(春天)中测试路线

[英]How to test routes in apache camel (spring)

这是我的system.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amq="http://activemq.apache.org/schema/core"
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
       http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <import resource="jetty.xml" />
    <import resource="communication.xml" />

    <camelContext xmlns="http://camel.apache.org/schema/spring"
        id="camel">
        <route> 
        <from uri="file://test.json"/>
            <threads>
                <bean ref="operationTest" method="test" />
            </threads>
        </route>
    </camelContext>
</beans>

这是我的communication.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/util 
    http://www.springframework.org/schema/util/spring-util.xsd">

    <bean id="operationTest" class="edu.test.Test">
    </bean>
</beans>

我有一个主要的

    context = new SpringServerContext(new FileSystemXmlApplicationContext("conf/system.xml"));

    Runtime.getRuntime().addShutdownHook(new Thread(group, new Runnable() {

        @Override
        public void run() {
            stop();
        }

    }, shutdownThreadName));
    context.startup();

并且Test类具有一种方法

    public Object test(Object info) {
//prints info
}

但是当我跑步时,什么也没打印。

我们不能通过文件触发from标记吗?

我也在尝试从Active MQ,但未成功收到错误消息

由于找不到以下端点:brokerURL,请检查您的类路径是否包含所需的Camel组件jar。

我使用Active MQ作为路由,并且有效

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM