-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamelSpringExample.java
More file actions
28 lines (26 loc) · 1021 Bytes
/
Copy pathCamelSpringExample.java
File metadata and controls
28 lines (26 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.mkoch.camel;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.spring.SpringCamelContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/*
* Camel route using Spring framework:
*
* from("activemq:TRADE.Order.Q")
*.to("bean:myBean?method=appendCamel")
*.to("stream:out")
*/
public class CamelSpringExample {
public static void main(String[] args) throws Exception {
ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml");
CamelContext camelContext = SpringCamelContext.springCamelContext(appContext, false);
try {
ProducerTemplate template = camelContext.createProducerTemplate();
camelContext.start();
template.sendBody("activemq:TRADE.Order.Q", "Hello World");
} finally {
camelContext.stop();
}
}
}