是否有任何适配器在spring集成过程后删除本地文件

时间:2017-10-17 18:03:31

标签: spring-integration

<file:outbound-channel-adapter id="processingDirOutputAdapter"
    directory=""
    delete-source-files="false" 
    channel="dataFileMoveToArchiveDir" 
    >
</file:outbound-channel-adapter>    

<int-file:inbound-channel-adapter id="inErrorINPRm"
                            channel="errorRm" 
                            directory="in/error"
                            >`enter code here`
<int:poller fixed-rate="5000" />
</int-file:inbound-channel-adapter>

<int:channel id="errorRm"/>
<int:publish-subscribe-channel id="ErrorRmMv"/>

<int-ftp:outbound-channel-adapter id="ftpError"
                            channel="ErrorRmMv" 
                            session-factory="ClientFactory"
                            auto-create-directory="true"
                            remote-directory="in/error"
                            >
</int-ftp:outbound-channel-adapter>

<int:service-activator id="cleanup" 
                        input-channel="ErrorRmMv" 
                        output-channel="nullChannel" 
                        order="3" 
                        expression="payload.delete('c:local/test/ + payload.name')"/>

现在在出站频道后我必须回到源本地文件夹删除本地文件才能清理文件夹

  1. file:outbound-channel-adapter将文件从源本地文件夹复制到本地错误文件夹(delete-remote-files =“false”)
  2. int-ftp:outbound-channel-adapter将文件从本地错误文件夹移动到远程错误文件夹
  3. 在li-ftp:outbound-channel-adapter将文件移动到远程错误文件夹后,
  4. service-activator应该去源本地文件夹完全删除文件

1 个答案:

答案 0 :(得分:1)

请参阅retry-and-more示例,了解如何将建议应用于出站适配器,以便在完成后执行操作。

您似乎没有应用我在my answer to your other question中建议的更改。

您赢得了什么工作 - ErrorRmMv上有两位订阅者 - 他们会收到替代消息。