Apache Camel を使用して、FTP サーバーからファイルをダウンロードしてルーティングしようとしています。ただし、ファイルは長い間 1 回だけ FTP サーバーに追加されるため、プログラムを継続的に実行するのは少し熱心すぎるようです。代わりに、毎週実行され、サーバーに追加された新しいファイルを処理する cron ジョブが必要です。
処理する新しいファイルがなくなったら、Camel を自動的にシャットダウンする方法はありますか?
私の現在のmain
機能は次のようになります。
public static void main (String[] args) throws Exception {
org.apache.camel.spring.Main main = new org.apache.camel.spring.Main ();
main.setApplicationContextUri ("applicationContext.xml");
main.enableHangupSupport ();
main.run (args);
}
の興味深い部分applicationContext.xml
は次のとおりです。
<camelContext>
<route>
<from uri="ftp://ftp.example.com/remoteDir?username=user&password=pass"/>
<to uri="file:../ftp_data?tempPrefix=."/>
</route>
</camelContext>