Announcement Announcement Module
Collapse
No announcement yet.
SFTP failed to transfer file every morning Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SFTP failed to transfer file every morning

    Hi,
    So my spring integration project is working great except for one issue. Every morning when my SFTP outbound-channel-adapter gives failed to transfer file error the first time and works great every time after that. My Config looks like

    <bean id="sftpSessionFactory" class="org.springframework.integration.sftp.sessio n.DefaultSftpSessionFactory">
    <property name="host" value="sftpserver"/>
    <property name="privateKey" value="file:id_rsa"/>
    <property name="user" value="username"/>
    </bean>

    <bean id="cachingSessionFactory" class="org.springframework.integration.file.remote .session.CachingSessionFactory">
    <constructor-arg ref="sftpSessionFactory"/>
    <property name="poolSize" value="${sftp.connections}"/>
    <property name="sessionWaitTimeout" value="1000"/>
    </bean>

    <intublish-subscribe-channel id="outputChannel" />

    <file:outbound-channel-adapter channel="outputChannel"
    auto-create-directory="true"
    directory-expression="headers['basePath'] + headers['path']"/>

    <sftp:outbound-channel-adapter id="sftpOutboundAdapter"
    session-factory="sftpSessionFactory"
    channel="outputChannel"
    charset="UTF-8"
    remote-directory-expression="headers['sftpBasePath'] + headers['path']"
    auto-create-directory="true" />


    Any tips would be greatly appreciated.


    thanks
    Jeff

  • #2
    This is probably because you are caching sessions and the server probably times out the session overnight.

    You really only need to cache the session if you are doing large volumes of requests (at other times - clearly not at night).

    If you want to cache the session, you can put a retry advice on the outbound adapter...

    http://static.springsource.org/sprin...r-advice-chain

    Comment

    Working...
    X