ftpで5分ごとにローカルディレクトリにファイルをダウンロードし、それぞれを処理してからローカルディレクトリから削除する必要があります。 私は春のFTPインバウンドアダプタの次のような構成Spring ftp統合。処理後にファイルを削除する
<int-ftp:inbound-channel-adapter
id="ftpPortAdapter"
channel="receiveChannel"
session-factory="ftpSessionFactory"
local-directory="/test"
local-filename-generator-expression="#this"
remote-directory="/prod"
auto-create-local-directory="true"
delete-remote-files="false"
filter="compositeFilter">
<int:poller fixed-delay="300000" max-messages-per-poll="-1"/>
</int-ftp:inbound-channel-adapter>
<bean id="compositeFilter" class="org.springframework.integration.file.filters.CompositeFileListFilter">
<constructor-arg>
<list>
<bean class="org.springframework.integration.file.filters.AcceptOnceFileListFilter"/>
<bean id="customFilter"
class="ru.lanit.parkomats.integration.impl.dozor.MyInboundChannelFilter">
<property name="initDate" value="2016-10-12 00:00:00"/>
</bean>
</list>
</constructor-arg>
</bean>
<int:channel id="receiveChannel">
</int:channel>
<int:service-activator input-channel="receiveChannel" ref="ftpFileService" method="processNewFiles">
<int:request-handler-advice-chain>
<bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
<property name="onSuccessExpression" value="payload.delete()"/>
<property name="onFailureExpression" value="payload.delete()"/>
</bean>
</int:request-handler-advice-chain>
</int:service-activator>
は、customFilterを持っているだけで、最後の5分間のリモートディレクトリに作成されたファイルのみを取得しています。最初にファイルをダウンロードして解析し、サービスアクティベータがそのジョブを完了した直後に、同じファイルを再度削除してダウンロードするように見えます。 サービスの解析が終了した後、ファイルのプルを停止する方法。または他のアイデア?