public void configure()

in tomcat-jdbc/src/main/java/sample/camel/MyCamelRouter.java [36:57]


    public void configure() throws Exception {
        // route to keep inserting messages in the database
        // start from a timer
        from("timer:hello?period={{myPeriod}}")
            .routeId("hello")
            // store the message from the bean in a header
            .setHeader("message").method(myBean, "saySomething")
            // prepare the insert SQL
            .setBody(simple("insert into messages(message) values('${header.message}')"))
            // insert the message into the database
            .to("spring-jdbc:default")
            // print the body
            .to("log:info");

        // route to print inserted messages
        from("timer:query?period={{myPeriod}}")
            .routeId("query")
            .setBody(constant("select count(*) as \"C\" from messages"))
            .to("spring-jdbc:default")
            .setBody(simple("There are ${body[0][C]} messages in the database."))
            .to("log:info");
    }