使用带有计时器组件的 spring DSL
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<route id="fetchdata">
<from uri="timer:somename?period=24h"/>
<toD uri="https://some/api/xxx?httpMethod=GET"/>
<to uri="file://abcd?fileName=${exchangeId}&fileExist=Append"/>
</route>
</routes>
在上面我们将它存储在文件中,如果你愿意,你可以将它发送到其他路由或队列
<to uri="activemq:queuename?jmsMessageType=Text&exchangePattern=InOnly"/>