Results 1 to 6 of 6

Thread: ftp inbound-channel-adapter download files

  1. #1
    Join Date
    Sep 2008
    Location
    Athens - Greece
    Posts
    11

    Default ftp inbound-channel-adapter download files

    Hello all,

    I am facing some trouble on a Web Application. I have the following configuration (I have omitted non relative stuff)

    <int:channel id="ftpChannel">
    <int:queue />
    </int:channel>

    <bean id="ftpClientFactory" class="org.springframework.integration.ftp.session .DefaultFtpSessionFactory">
    <property name="host" value="${host}"/>
    <property name="port" value="${port}"/>
    <property name="username" value="${username}"/>
    <property name="password" value="${password}"/>
    <property name="clientMode" value="0"/>
    <property name="fileType" value="2"/>
    <property name="bufferSize" value="100000"/>
    </bean>

    <int-ftp:inbound-channel-adapter id="ftpInbound"
    channel="ftpChannel"
    session-factory="ftpClientFactory"
    charset="UTF-8"
    auto-create-local-directory="true"
    delete-remote-files="true"
    filename-pattern="*.txt"
    remote-directory="/the/remote/directory/"
    remote-file-separator="/"
    local-directory="/the/local/directory/">
    <intoller fixed-rate="1000" max-messages-per-poll="-1"/>
    </int-ftp:inbound-channel-adapter>

    I would expect that whenever a new file would be created at ${host}:/the/remote/directory/ it would be downloaded locally to /the/local/directory. But this doesn't. Instead, after activating all relevant logs I get:

    SimplePool:177 - Obtained org.springframework.integration.ftp.session.FtpSes sion@29ab0eef from pool.
    CachingSessionFactory:109 - Releasing Session back to the pool.
    CachingSessionFactory:109 - Releasing Session back to the pool.
    SimplePool:210 - Releasing org.springframework.integration.ftp.session.FtpSes sion@29ab0eef back to the pool
    SourcePollingChannelAdapter:71 - Received no Message during the poll, returning 'false'

    What am I missing? Any help is appreciated

    thanx
    /axel

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

    Default

    When posting code and config, please use [ code ] ... [ /code ] (no spaces in brackets).

    The adapter uses the Apache commons FTP client under the covers; it works just fine; you must have some configuration problem; maybe the user doesn't have read access to the file?

    Can you manually ftp to the siite with the same credentials and list ('ls') the files?

    If you use a wire monitor, such as WireShark, you can see the ftp traffic.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Sep 2008
    Location
    Athens - Greece
    Posts
    11

    Default

    Hello,

    thanx for the reply. I am sorry for not using the [code] convention.

    The user credentials are fine. Using them through terminal I can download the file. So, I guess that this is not the problem. I'll try to monitor the ftp traffic, but to be honest, I am not sure I'll see anything. You see, the log messages, kind of indicate that there is no change in the remote directory so nothing is downloaded. Or I might be completely off track...

    any other idea?

    Thanx again for the reply

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,012

    Default

    The only other thing to watch out for is if a file with the same name already exists locally, it won't be copied again. If you are using the same file name multiple times, you must remove it locally after processing.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5
    Join Date
    Sep 2008
    Location
    Athens - Greece
    Posts
    11

    Default

    yeap, checked that also. There is no file with the same name in the local directory.

    I can't seem to get it to work

  6. #6
    Join Date
    Sep 2008
    Location
    Athens - Greece
    Posts
    11

    Default RESOLVED: ftp inbound-channel-adapter download files

    I finally got it to work. It was a configuration issue that escaped my eye in the first place.

    If you check my original post the ftpClientFactory bean has the following parameter

    Code:
    <property name="clientMode" value="0"/>
    which directs to ACTIVE_LOCAL_DATA_CONNECTION_MODE

    while it should be set to

    Code:
    <property name="clientMode" value="2"/>
    which directs to PASSIVE_LOCAL_DATA_CONNECTION_MODE

    thanx for the effort, I hope someone will find this usefull

    /axel

Posting Permissions

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