如何触发和轮询 ftp 出站网关
我正在尝试使用递归方法的 ftp 出站网关从 ftp 服务器传输文件,因为我的 ftp 服务器将生成新的随机名称文件夹,并且我需要获取所有内容。我只知道这种方法有效,除非有人可以建议更简单的方法。无论如何,这是我的代码。
@Bean(value = "ftpTolocal")
public IntegrationFlow fileToFile() {
IntegrationFlow flow = IntegrationFlows
.from("inputChannel")
.handle(Ftp.outboundGateway(defaultFtpSessionFactory(),
AbstractRemoteFileOutboundGateway.Command.MGET,
null)
//.regexFileNameFilter("(.*n.txt)")
.autoCreateDirectory(true)
.options(AbstractRemoteFileOutboundGateway.Option.RECURSIVE)
.localDirectoryExpression("'/localDirectory/' + #remoteDirectory"))
.channel("nullChannel")
.get();
return flow;
}
我进行了搜索,我总是得到的答案是创建一条 inputChannel 消息,但我找不到真正告诉我如何执行此操作的消息。我也看到了很多xml解决方案,但我找不到如何实现它。 FTP集成指南似乎很少见,而且对于像我这样的菜鸟来说,解释似乎很难理解。提前致谢。
I am trying to transfer files from an ftp server using the ftp outbound gateway with recursive method as my ftp server will generate new random name folder and I need to fetch everything. I only know this method work, unless anyone can suggest easier one. Anyway, this is my code.
@Bean(value = "ftpTolocal")
public IntegrationFlow fileToFile() {
IntegrationFlow flow = IntegrationFlows
.from("inputChannel")
.handle(Ftp.outboundGateway(defaultFtpSessionFactory(),
AbstractRemoteFileOutboundGateway.Command.MGET,
null)
//.regexFileNameFilter("(.*n.txt)")
.autoCreateDirectory(true)
.options(AbstractRemoteFileOutboundGateway.Option.RECURSIVE)
.localDirectoryExpression("'/localDirectory/' + #remoteDirectory"))
.channel("nullChannel")
.get();
return flow;
}
I have searched and the answer I always get is to create an inputChannel message but I couldn't find one that actually tells me how to do it. I also see many xml solution, but I couldn't find how to implement it. FTP integration guide seems rare and the explanation seems difficult to understand for a rookie like me. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)