TL DR
from ("timer: // scheduler? fixedRate = true & period = 5s"). log ("Hello World!");
Let me introduce you to the simplest example written in Java DSL. I will use the Spring Boot Camel starter to configure the simplest executable code. This example will help you register a Hello World! to your console every 5 seconds in accordance with the quartz2 cron component of quartz2 .
Documentation to view:
Here is your simple Spring Boot demo application:
package com.lordnighton.camel.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
Here is the easiest route that logs a HelloWorld! message HelloWorld! to the console every 5 seconds:
package com.lordnighton.camel.demo.routes; import org.apache.camel.builder.RouteBuilder; import org.springframework.stereotype.Component; @Component public class LogMessageRoute extends RouteBuilder { @Override public void configure() throws Exception { from("quartz2://logMessageGroup/logMessageTimer?cron=0/5+*+*+*+*+?") .log("Hello World!"); } }
source share