[Camel]Using spring.xml to Walk through an Example

阅读更多

Walk through an Example:

http://cwiki.apache.org/confluence/display/CAMEL/Walk+through+an+Example

springExampleUsingNamespaces.xml

使用spring.xml配置路由:

 





























 

Main.java


1.创建一个CamelContext;
2. 在CamelContext中发送对象(本例为文字),发送到的Component为test-jms:queue:test.queue.

public class Main {

public static void main(String args[]) throws Exception {

ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"org/apache/camel/example/spring/springExampleUsingNamespaces.xml");

SpringCamelContext camelContext = (SpringCamelContext) applicationContext
.getBean("camel");

CamelTemplate template = new CamelTemplate(camelContext);
camelContext.start();

template.sendBody("test-jms:queue:test.queue", "Test Message" );

Thread.sleep(1000);
camelContext.stop();
}
}
 

你可能感兴趣的:(Spring,XML,ActiveMQ,JMS,Apache)