Product:webMethods
Components:Intergration server
Version: 10.7
fix: IS_10.7_Core_Fix5
I am using pub.client.sftp:login and noticed there’s an optional parameter reuseSession . When set to true, all connections will reuse the already opened session. However, I have a question: if I call pub.client.sftp:login with reuseSession set to true within a flowservice, and then call pub.client.sftp:logout before the flowservice ends, what will happen? Do I need to call pub.client.sftp:logout to log out of SFTP after using the SFTP connection with reuseSession set to true?
In the flowservice shown in the picture, its function is to send multiple images to SFTP, and this flowservice might be called concurrently. I hope to keep the session open after uploading the images, because it involves concurrent calls.
If I set the parameter reuseSession to true, does it mean that I don’t need to perform the logout operation? Because I have tested the following:
When I set the parameter reuseSession to true and do not perform the logout operation, the sessionKey obtained in the next run is the same as the previous one.
If I call the logout service, the sessionKey obtained in the next run changes.
Summary: What I want is, when calling this flowservice concurrently, to avoid frequent logins and logouts, as frequent logins and logouts seem to significantly impact performance.
In general, it’s better to logout after every sftp login.
For your requirement I think below options will work
Option 1) Ask Source System/API/user to consolidate all his requests and send as one request to webMethods. Loop your sftp put on consolidated request payload.
2) Change your design such that wm service connects source system every 10 or 15 mins and gets all requests and send to target system in a single sftp login/logout.
3) Your webMethods service consolidate concurrent calls from source system/API into a consolidated request payload file/db table and perform SFTP put operation for every 10/15 mins.
4) Increase number concurrent sessions of sftp user in /etc/ssh/sshd_config.
In an SFTP client, the same session can only execute one command at a time. Therefore, it is not recommended to use the reusesession parameter in concurrent scenarios, as it may result in numerous errors.
please refer to the IS Built-In-Services Reference for your wM version for documentation of this service.
pub.client.sftp:login
WmPublic. Connects to a remote SFTP server and logs in with the specified SFTP user
alias.
Important: You must use this service to initiate an SFTP session before using most other
pub.client.sftp services.
Input Parameters
userAlias String Alias containing the SFTP client configuration for an SFTP
user account. Integration Server creates a new session each time
it logs on to the SFTP server and returns the session key to the
user.
reuseSession String Flag indicating whether or not Integration Server reuses a
session that is already open for the specified user alias. Set to:
– true to reuse the session that is already open for the specified
user alias. If no session is open for this user alias, the
pub.client.sftp:login service will create a new session and return the
key for this new session.
– false to create a new session for the specified user alias. This is
the default.
Output Parameters
sessionKey String Unique key for the current SFTP session. Most other
pub.client.sftp services require this session key to execute.
returnCode String Standard SFTP protocol return code.
returnMsg String Text message describing the return code.
Usage Notes
You cannot execute SFTP commands in parallel using the same session key.