Skip to content

Instantly share code, notes, and snippets.

@hinunbi
Created October 8, 2013 08:13
ToConsole.java
package camel.example.hello;
import java.util.Date;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.spring.Main;
public class ToConsole {
public static void main(String[] args) throws Exception {
String ctxPath = "camel/example/hello/ToConsole.xml";
Main main = new Main();
main.setApplicationContextUri(ctxPath);
// Camel 컨텍스트 실행
main.start();
// Camel 생산자(발신자) 객체 획득
ProducerTemplate producer = main.getCamelTemplate();
// 메시지 발신
producer.requestBody("direct:start", "Hello World! at " + new Date());
// Camel 컨텍스트 종료
main.stop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment