Announcement Announcement Module
No announcement yet.
Is it possible to poll sftp:outbound-gateway? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it possible to poll sftp:outbound-gateway?

    Hello everyone. Having some trouble in implementing this scenario.

    Poller with cron -> channel -> ftp:outbound-gateway with LS command -> channel -> filter -> channel -> ftp:outbound-gateway with GET command -> channels

    Requirement is that i should poll a remote ftp for a given file and if that file exists to copy ANOTHER (target) file to a local machine.
    I've tried using a sftp:inbound-channel-adapter and it copies the remote file but it sends the message to output channel only the first time the remote file is copied. After that it just copies the remote file but does not send a message to output channel. Thats why I want to use two gateways (one LS another Get) to check whether the remote file exists and copy the target file.

    Any advice?

  • #2
    Having some trouble in implementing this scenario.
    What "trouble" are you having?

    You don't poll the outbound gateway, you can poll an inbound-channel-adapter...

    <int:inbound-channel-adapter channel="toLS" expression="/foo/">
        <int:poller fixed-rate="60000" />
    In this case, the adapter will put a message on the 'toLS' channel containing the path for the LS every 60 seconds.


    • #3
      Thanks a ton Gary! Thats exactly what i needed.


      • #4
        I am using SftpInboundFileSynchronizer class within my Spring Batch Admin application. I have noticed
        SFTP Sync is taking too much of time to pull a file from remote location to local mount point. I tried to test the same using plain shell script, which works very fast.


        Are there any parameters or settings which can speed up file transfer.



        • #5
          I cant tell you for sure why this is happening.

          Could you enable logging to see what's causing the slow speed? Also check the configuration on session factory and eliminate all other beans involved in flow (maybe they affect somehow the performance by doing IO/Network heavy operations) Also use the same folders for testing.

          If you find the problem please let us know.


          • #6
            I figured out. The issue is with the underlying JSch - Java Secure Channel, the older version has this issue. Upgrading to new version resolved this issue.


            • #7
              Can you share version information? Spring Integration currently ships with a default dependency of 0.1.45.



              • #8
                I updated my jsch artifact with 0.1.49. This works fine.



                • #9
                  Thanks for the info salano21. Judging by release notes for jsch 1.48 they improved sftp transfer speed:

                  I'd say this should be updated in Spring Integration then.
                  What do you think Gary?


                  • #10
                    Already done (in the 3.0 stream).



                    Users of earlier versions can simply add the dependency to their pom or build.gradle.