Reputation: 309
I've a problem with Camel and quartz. I wanto to execute a trigger with Quartz so i wrote this simple code, where I want to print the time every two second on the console :
public class TestQuartz {
public static void main(String args[]) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("quartz://myTimer?trigger.repeatInterval=2000&trigger.repeatCount=-1").setBody().simple("Current time is ${header.firedTime}").to("stream:out");
}
});
context.start();
Thread.sleep(10000);
context.stop();
}
}
And I obtain this exception: Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[quartz://myGroup/myTimerName?cron=0+0+8+... because of Failed to resolve endpoint: quartz://myGroup/myTimerName?cron=0+0+8+*+*+* due to: No component found with scheme: quartz
I start by saying that I've inserted in the pom.xml the dependency:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quartz2</artifactId>
<version>${camel.version}</version>
</dependency>
where camel.version is 2.15.1
Can someone help me?
Upvotes: 5
Views: 6814
Reputation: 283
You're importing the camel-quartz2 component in your pom.xml file whilst trying to use the old quartz component.
Quartz: http://camel.apache.org/quartz.html
Quartz2: http://camel.apache.org/quartz2.html
Try the following URI for the route:
quartz2://myTimer?trigger.repeatInterval=2000&trigger.repeatCount=-1
Upvotes: 5