Apache Camel Scheduler error: Failed to resolve endpoint

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[=11=]0(DefaultCamelContext.java:167)
at org.apache.camel.impl.DefaultCamelContext.call(DefaultCamelContext.java:2467)
at org.apache.camel.impl.DefaultCamelContext.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}