下载集从FTP与骆驼的文件通过REST调用
问题描述:
我想通过REST调用使用骆驼的路线从FTP下载文件集: 我想以下几点: from("cxfrs:bean:restndpoint") .pollEnrich("some ftp url") .to("destinationFilesLocation") .bean(MyBean.class);
它仅适用于一个文件在ftp上,当我试图运行它再一次它只是等待文件。如果我用(“某些ftp url”替换pollEnrich(“某个ftp url”)机智),骆驼不会等待休息时间,随时调用下载文件。下载集从FTP与骆驼的文件通过REST调用
答
这就是pollEnrich EIP模式的工作原理。它轮询单个消息。
您的用例通过REST调用下载一组FTP文件听起来更像是您应该使用Control Bus EIP模式,其中REST调用将触发启动另一个执行FTP下载的路由。
答
像这样的事情对我的作品:
from("cxfrs:bean:restndpoint")
.to("controlbus:route?action=start&routeId=ftpRouteId&async=true");
from("some ftp url").routeId("ftpRouteId").noAutoStartup()
.choice()
.when(body().isNull())
.to("direct:extract")
.otherwise()
.to("destinationFilesLocation");
from("direct:extract")
.to("controlbus:route?action=stop&routeId=ftpRouteId&async=true")
.bean(MyBean.class);
谢谢您的回答。这听起来正是我需要的。你能指点一下路线应该是什么样子的例子吗? –