![](/img/trans.png)
[英]Apache camel cron error because of Failed to resolve endpoint: cron
[英]Apache Camel Scheduler error: Failed to resolve endpoint
我正在尝试使用“调度程序组件-http://camel.apache.org/scheduler.html,但出现错误。我需要每60秒触发调度程序并调用我的bean。我从文档中提取了示例,并尝试照原样实施,但失败。
public class SchedulerRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("scheduler://foo?period=6000&delay=50").to("bean:logBean?method=sayHello");
}}
我收到此错误:
org.apache.camel.FailedToCreateRouteException: Failed to create route route2: Route(route2)[[From[scheduler://foo?period=6000&delay=50]] -... because of Failed to resolve endpoint: scheduler://foo?delay=50&period=6000 due to: Failed to resolve endpoint: scheduler://foo?delay=50&period=6000 due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{period=6000}]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:190)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:841)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2895)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2618)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:167)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2467)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2463)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2486)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2463)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2432)
at com.acn.cs.filedownloader.MainApp.main(MainApp.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
我尝试了TIMER组件,它可以完美运行,但不能运行调度程序。
此代码可与计时器组件一起使用
public class SchedulerRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer://foo?fixedRate=true&period=6000").to("bean:logBean?method=sayHello");
}}
有什么想法我在这里想念吗?
那是调度程序文档中的一个错误。 没有名为period
选项。 您应该使用delay
来设置触发频率。 我现在正在更新文档,因此下次生成该网站时正确。
http://camel.apache.org/scheduler
这也是异常消息告诉您的内容:未知参数= [{period = 6000}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.