![](/img/trans.png)
[英]How to start the Camel route using spring scheduler instead of camel timer
[英]How can I manually start a Camel Route through Spring XML?
我已將路線的autoStart設置為false:
<route id="myRoute" autoStartup="false">
我在網上可以找到的所有關於如何啟動它的內容都是在Java中啟動它,並說要調用startRoute("myRoute");
在camelContext上..但是我找不到關於如何從Spring XML的路由中調用它的任何信息。
這是我的設置:
<route id="myRoute" autoStartup="false">
<from uri="ftp://remote/dir" />
<to uri="file:///local/dir" />
</route>
<route id="kickOff">
<from uri="timer://runOnce?repeatCount=1&delay=30000" />
<!-- START myRoute HERE -->
<to uri="bean:postProcessor?method=postProcess" />
</route>
我的目標是讓FTP一次獲取FTP上的所有文件,然后停止該路由。 目前,它將繼續無限期輪詢FTP。 我嘗試添加一個限制為1的org.apache.camel.impl.LimitedPollingConsumerPollStrategy
,但這似乎並沒有改變。
請參見Controlbus eip /組件,您可以在其中啟動路線:
代碼應該類似:
<route id="kickOff">
<from uri="timer://runOnce?repeatCount=1&delay=30000" />
<to uri="controlbus:route?routeId=myRoute&action=start" />
<to uri="bean:postProcessor?method=postProcess" />
</route>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.