"Beacuase ftp login is consuming more time and I don’t think its a good idea to repeat unnecessary steps "
While it seems intuitively obvious that logging in and out will consume more time, have you done any measurements to see if the time consumed is meaningful? Is logging in and out a real problem?
Since IS is a multi-threaded environment, and you have little to no control over those threads, you have two choices that I can see.
-
Continue with the path you’ve begun and use a single FTP session for all threads. To avoid conflicts, you’ll need to serialize (synchronize) access such that only 1 thread can be doing FTP at one time. You’ll also need to make sure that each FTP operation leaves the FTP session in a good state for later thread use. Also, you’ll want to avoid CD commands using relative paths (which may be a problem, depending on the FTP server and how things are set up).
-
Implement an FTP connection pool. This provides a configurable set of persistent sessions that can be sized as needed. When a particular integration process needs a session, it borrows one from the pool, does the work, then returns the session to the pool. The session will still need to be left in a good state for later use.
Option 1 won’t scale very well. Option 2 can provide a nice balance between scaling and logging in and out all the time. For option 2, you’ll have to implement your own pool, possibly using open source that can help. If it were up to me, I’d simply log in and out all the time unless there was a compelling reason to not do so–then I’d go with option 2.
#Integration-Server-and-ESB#webMethods#webmethods-Protocol-and-Transport