4 Replies Latest reply on Oct 28, 2009 4:07 AM by nl

    FTP Listener and number of connections that are opened

    garuda

      Hello experts.

      one of our customer uses BAN control on his ftp - server "ftp.x.com", which means that server is getting blocked in case connection frequency of all clients is higher then 5 times per Minute. Due to this issue, I have the following thoughts. Unfortunately I found nothing in the documentation.


      Let`s assume the following jboss-esb.xml of service: "TestService"

      <ftp-provider hostname="ftp.test.com" name="FtpGateway">
       <ftp-bus busid="test1">
       <ftp-message-filter directory="/directory1"
       error-directory="/directory1" input-suffix=".xml"
       password="masterpw" post-delete="false"
       post-directory="/directory1" post-suffix=".archived"
       protocol="ftp" read-only="false" username="master" work-suffix=".work"/>
       </ftp-bus>
      
      <ftp-bus busid="test2">
       <ftp-message-filter directory="/directory2"
       error-directory="/directory2" input-suffix=".xml"
       password="masterpw" post-delete="false"
       post-directory="/directory2" post-suffix=".archived"
       protocol="ftp" read-only="false" username="master" work-suffix=".work"/>
       </ftp-bus>
       </ftp-provider>
      ...
      <services>
       <service category="AnyServiceCategory" description="lala" name="TestService">
       <listeners>
       <jms-listener busidref="EdiFTPEsbChannel" maxThreads="1" name="FTP-ESBListener"/>
       <ftp-listener busidref="test_1" is-gateway="true"
       maxThreads="1" name="Listener1" schedule-frequency="300"/>
       <ftp-listener busidref="test_2" is-gateway="true"
       maxThreads="1" name="Listener2" schedule-frequency="300"/>
      </service>
      </services>
      ...
      


      How many connections are TestService opened initially and on schedule
      time-points ?
      - 1 connection for user "master" because initially and / or schedule - frequency is equal for all ftp-listener ?
      - 2 connections, one for each ftp-listener (although its the same user and same schedule-frequency)?

      Thank you very much for your help.

      Best regards,

      Dennis



        • 1. Re: FTP Listener and number of connections that are opened
          nl

          One point is, that the RemoteGatewayListener is doing a real login within its init phase (see checkMyParms()):

          RemoteFileSystem rfs = RemoteFileSystemFactory.getRemoteFileSystem(ftpEpr, true);


          Is this really needed? Wouldn't it be better to make the last argument configurable? Or would it lead to unexpected results?

          Regards,

          Niels

          • 2. Re: FTP Listener and number of connections that are opened
            nl

            Ok, this seems to be worse than I've thought.

            The RemoteGatewayListener is opening a connection on each action.
            So if there are n files on the server, it'll need at least

            1 (getFileList) + n*2 (getFile + rename/delete) connections.

            Isn't it possible to reuse the connection until last file is processed?

            • 3. Re: FTP Listener and number of connections that are opened
              tomeicher

              Well, of course that's doable, but the design of the interfaces and
              classes doesn't look like anybody is eager to change all that...

              In such cases, I just copy the class in question over to my source tree,
              change the package (mind the license header) and implement my
              changes.

              Holding the connection as a member shouldn't be too hard, but I
              guess you must disallow concurrent access somehow...

              Cheers, Tom.

              • 4. Re: FTP Listener and number of connections that are opened
                nl

                Hi Tom,

                each schedule uses its own Listener (subsequent schedules may share). So what I did is keep the connection as a member at time of onSchedule() Method and close it afterwards, since with finishing this method, all files are being processed.

                I also created a JIRA Issue for this (JBESB-2914) since this behaviour is not enterprise ready. Simple FTP is one thing, but think of secure connections...

                Regards,

                Niels