Fuse/Camel: 如何在只下载一个文件后停止

Fuse/Camel: How to stop after downloading just one file

Fuse/Camel 这里是新手。我正在尝试使手动过程自动化,其中 .done 文件从 FTP 主机下载,然后重命名为 "fileout.txt",最后在该文件上执行 AS/400 程序。

但是,主持 AS/400 计划的部门没有资源来更新他们的计划。我正在努力的解决方案是让 Camel 一次下载一个文件,将其保存为 "fileout.txt",然后执行 JT400 程序来处理它。这些步骤单独工作,但我遇到了一个问题。

亲爱的 reader,我请求你能帮我的是 “如何在只下载一个文件后停止 Camel? (因为覆盖、追加或下载多个文件对以下步骤不起作用)。

How can I stop Camel after downloading just one file?

您可以在 FTP consumer

中设置以下参数
  • maxMessagesPerPoll=1(限制单批下载的消息数)
  • delay=500000(增加每次轮询的时间间隔,让你有时间停下路由)

然后,您的 ftp 路由可以触发异步消息(可能 wireTap component) to another route to trigger controlBus component 通过路由 ID 停止 ftp 路由。

I'm trying to automate a manual process where .done files are downloaded from an FTP host, then renamed fileout.txt, and finally an AS/400 program is executed on that file

除了 stop/start 您的路线,您可以尝试 pollEnrich component 和 FTP 用法。使用 pollEnrich,如果您已经知道目标文件名,则可以在需要时触发一次 FTP 消费者。