Using the inbound adapter described above, it is possible for the following events to happen:Code:<int-ftp:inbound-channel-adapter id="import.ftp" remote-directory="/Export" filename-regex="\d+\.csv" local-directory="file:/${import.temp.dir}" auto-create-local-directory="true" temporary-file-suffix=".downloading" delete-remote-files="true" channel="import.message" session-factory="import.ftpsessionfactory" charset="UTF-8" remote-file-separator="/" > <int:poller max-messages-per-poll="1" trigger="import.ftptrigger" task-executor="integration.executor" error-channel="import.ftp.error"/> </int-ftp:inbound-channel-adapter>
1) fetch file 111.csv from remote ftp
2) save it as ${import.temp.dir}/111.csv
3) try and fail at deleting 111.csv at the remote ftp
If the remote delete fails like so:
the next next time the import.ftptrigger trigger launches, the inbound adapter will use the synchronized ${import.temp.dir}/111.csv as the source, leaving the original message still at the remote ftp server. If the context is restarted, the ftp inbound adapter will handle 111.csv again.Code:Caused by: java.io.IOException: Failed to delete '/Export/111.csv'. Server replied with: 550 Permission denied. at org.springframework.integration.ftp.session.FtpSession.remove(FtpSession.java:55) at org.springframework.integration.file.remote.session.CachingSessionFactory$CachedSession.remove(CachingSessionFactory.java:129) at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.copyFileToLocalDirectory(AbstractInboundFileSynchronizer.java:202) at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:138)
The MessagingException raised, will not contain a failedMessage, so the only way I could react to the file is by parsing the IOException cause. Is there something I could do to delete the synchronized file if the remote delete fails? Or is this perhaps a straight up bug?
I'm using Spring Integration 2.0.1, but looking at AbstractInboundFileSynchronizingMessageSource sources, this is still the case in HEAD of the master branch.


Reply With Quote