Results 1 to 10 of 10

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

  1. #1
    Join Date
    Feb 2013
    Posts
    4

    Default 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. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Feb 2013
    Posts
    4

    Default

    Thanks a ton Gary! Thats exactly what i needed.

  4. #4
    Join Date
    Feb 2013
    Posts
    5

    Default

    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

  5. #5
    Join Date
    Feb 2013
    Posts
    4

    Default

    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. #6
    Join Date
    Feb 2013
    Posts
    5

    Default

    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. #7
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

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

    Thanks
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  8. #8
    Join Date
    Feb 2013
    Posts
    5

    Default

    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>

  9. #9
    Join Date
    Feb 2013
    Posts
    4

    Default

    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?

  10. #10
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •