How to correctly use the 'reuseSession' parameter when logging in with SFTP

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?

Try to provide a screen shot of your flow service , how you want to sequence sftp login and logout.

Thank you for your response.

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.

Thank you for your suggestion. I will try these solutions.

Have a good day!