Announcement Announcement Module
Collapse
No announcement yet.
sftp:outbound-channel-adapter is corrupting zip files during copy to remote machine Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • sftp:outbound-channel-adapter is corrupting zip files during copy to remote machine

    Hi All,
    i'm using sftp adapter to copy zip files from one to another unix machines. in some cases the copied file in destination is not copied completely and been corrupted.

    the unzip error is:

    End-of-central-directory signature not found. Either this file is not
    a zipfile, or it constitutes one disk of a multi-part archive. In the
    latter case the central directory and zipfile comment will be found on
    the last disk(s) of this archive.
    attached a sample of corrupted file...

    my configuration is:

    Code:
    	<bean id="sftpSessionFactory"
    		class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
    		<property name="host" value="localhost" />
    		<property name="port" value="22" />
    		<property name="user" value="user1" />
    		<property name="password" value="pass1" />
    	</bean>
    
    	<int-file:inbound-channel-adapter id="DataOutboundFileAdapter"
    		directory="${data.outbound}" channel="DataOutByteChannelIN"
    		filename-regex=".*\.zip$">
    	</int-file:inbound-channel-adapter>
    
    	<int-sftp:outbound-channel-adapter
    		id="DataSftpOutboundAdapter" session-factory="sftpSessionFactory"
    		channel="DataOutByteChannelIN" remote-file-separator="/"
    		auto-create-directory="false" remote-directory="${data.location}"
    		temporary-file-suffix="temp" />
    please advice,
    thanks,

  • #2
    How do files arrive in ${data.outbound}?

    It is a common mistake to write files with their final name directly; this can cause a partial file to be picked up before it is fully written.

    Many systems use a technique similar to our outbound adapters, where the file is written with a temporary file sufiix (e.g. foo.zip.writing) and then renamed to its final name (foo.zip) after it is completely written.

    With appropriate filters, the inbound adapter won't see the partial files, just the complete ones.

    Comment


    • #3
      Thanks Gary,
      I'm archiving it manualy directly to this location. i will try your suggestion.

      Comment


      • #4
        Thanks Gary !!!
        the issue resolved, after generating teh files with tmp suffix just after completion renamed to final name and now it seems to be working fine.

        Thanks

        Comment

        Working...
        X