【发布时间】:2018-01-31 20:23:00
【问题描述】:
我有一个集成案例,从 FTP 获取 xml 有效负载,然后使用 http 出站通道将有效负载发送到 webservice,ftp inbound-channel-adapter 有一个名为 local-directory 的强制属性,但是将在此处下载远程 ftp 文件当我重新启动时,似乎本地目录中的所有文件都会被再次处理,我可以知道如何避免这种情况吗? 一种可能的方法是在 ftp inbound-channel-adapter 中删除本地文件,怎么做,您能建议吗?
谢谢
我的 Spring 集成配置
<ftp:inbound-channel-adapter
channel="requestChannel"
session-factory="ftpClientSessionFactory"
remote-directory="/outbound"
local-directory="/temp"
auto-create-local-directory="true"
delete-remote-files="false"
filename-pattern="*.xml"
temporary-file-suffix=".writing">
<int:poller fixed-delay="5000" max-messages-per-poll="10"/>
</ftp:inbound-channel-adapter>
<int:chain id="inboundChain" input-channel="requestChannel" output-channel="replyChannel">
<int:transformer ref="xmlToJsonTransformer" />
<int:transformer ref="jsonToMapTransformer" />
<int:header-enricher>
<int:header name="Content-Type" value="application/json" overwrite="true"/>
</int:header-enricher>
<http:outbound-gateway expected-response-type="java.lang.String"
url="http://localhost:8080/postService/postupdate"
http-method="POST"
extract-request-payload="true"
request-factory="requestFactory">
</http:outbound-gateway>
</int:chain>
【问题讨论】: