【发布时间】:2015-04-22 11:40:10
【问题描述】:
我对骆驼和石英有疑问。 我想用 Quartz 执行触发器,所以我写了这个简单的代码,我想在控制台上每两秒打印一次时间:
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();
}
}
我得到了这个例外: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
我首先说我在 pom.xml 中插入了依赖项:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quartz2</artifactId>
<version>${camel.version}</version>
</dependency>
camel.version 是 2.15.1
有人可以帮我吗?
【问题讨论】:
标签: java maven apache-camel quartz-scheduler