135.7. 示例
要设置一个路由,该路由每 60 秒生成事件:
from("timer://foo?fixedRate=true&period=60000").to("bean:myBean?method=someMethodName");
from("timer://foo?fixedRate=true&period=60000").to("bean:myBean?method=someMethodName");
以上路由将生成一个事件,然后在 Registry 中调用名为 myBean 的 bean 的 someMethodName 方法。
和 Spring DSL 中的路由:
<route> <from uri="timer://foo?fixedRate=true&period=60000"/> <to uri="bean:myBean?method=someMethodName"/> </route>
<route>
<from uri="timer://foo?fixedRate=true&period=60000"/>
<to uri="bean:myBean?method=someMethodName"/>
</route>