Skip to content

Instantly share code, notes, and snippets.

Created May 7, 2013 09:23
What would you like to do?
import java.util.Date;
import org.apache.camel.Exchange;
import org.apache.camel.LoggingLevel;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.main.Main;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MainApp2 {
private static Logger logger = LoggerFactory.getLogger(MainApp2.class);
private Main main;
public static void main(String[] args) throws Exception {
MainApp2 app = new MainApp2();
public void boot() throws Exception {
// create a Main instance
main = new Main();
// enable hangup support so you can press ctrl + c to terminate the JVM
// add routes
main.addRouteBuilder(new MyRouteBuilder());
// run until you terminate the JVM"Starting Camel. Use ctrl + c to terminate the JVM.\n");;
private static class MyRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
from("timer://exercise1delay=2000").routeId("# Timer Exercise 1 #")
.log(LoggingLevel.INFO, ">> This is the first Camel exercise")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {">> Invoked timer at " + new Date());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment