Announcement Announcement Module
Collapse
No announcement yet.
Is it possible to poll sftp:outbound-gateway? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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...

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

    Comment


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

      Comment


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

        org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizer


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

        Regards
        Salano

        Comment


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

          Comment


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

            Comment


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

              Thanks

              Comment


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

                <dependency>
                <groupId>com.jcraft</groupId>
                <artifactId>jsch</artifactId>
                <version>0.1.49</version>
                </dependency>

                Comment


                • #9
                  Thanks for the info salano21. Judging by release notes for jsch 1.48 they improved sftp transfer speed: http://freecode.com/projects/jsch/releases/344090

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

                  Comment


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

                    https://jira.springsource.org/browse/INT-2968

                    https://github.com/SpringSource/spri...896dc1ea34a64e

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

                    Comment

                    Working...
                    X