2017-10-10 89 views
1

這是我的system.xml如何測試在Apache的駱駝(春季)路線

<?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(); 

和測試類有一個方法

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

然而,當我跑步時,沒有打印。 。 。

我們不能通過文件觸發from標籤嗎? brokerURL,請檢查您的類路徑中包含所需駱駝組成的jar:

我也是從Active MQ嘗試,沒有的強校得到,因爲沒有終點的

的錯誤可能爲找到。

回答