Announcement Announcement Module
Collapse
No announcement yet.
ftp-inbound-adapter and failure to delete remote file causes issues Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ftp-inbound-adapter and failure to delete remote file causes issues

    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>
    Using the inbound adapter described above, it is possible for the following events to happen:

    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:

    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 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.

    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.

  • #2
    I wouldn't say it's a bug exactly, but I can see room for 'Improvement', such as, say, generating a JMX notification when this happens (https://jira.springsource.org/browse/INT-2486). A jmx inbound adapter could then consume that event. I will make a note on INT-2486; feel free to vote/watch it.

    BTW, 2.0.1 is very old; the current version is 2.1.2; 2.0.6 is the latest 2.0.x version.

    Comment

    Working...
    X