【问题标题】:How to test routes in apache camel (spring)如何在 apache camel (spring) 中测试路由
【发布时间】:2017-10-10 05:33:58
【问题描述】:

这是我的 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。

【问题讨论】:

    标签: java spring apache apache-camel


    【解决方案1】:

    我在路由中使用了 Active MQ,它工作正常

    【讨论】:

      猜你喜欢
      • 2017-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-07
      • 2021-04-30
      • 2016-09-29
      • 2018-07-29
      • 2017-03-28
      相关资源
      最近更新 更多