I have developed a code where in we are connecting to application servers using sftp. Since we have to logout the sessions in case of success/failure, i have implemented the finally block.
Below is the flow:
MAIN[EXIT ON SUCCESS]
-TRY[EXIT ON FAILURE]
-CATCH[EXIT ON DONE]
FINALLY[EXIT ON DONE]
In the catch block, the last step is exit from parent and signal failure, so in case of failures, the finally block is unable to get the pipeline values, since at the exit step, the pipeline is being cleared.
Could someone please help me know how we can save the pipeline value(session names) in case of errors, so we can log out in finally block.
In that case, we need to place logout service in try as well as in catch so during success, it will be implemented in try and in case of error, it will be implemented in Catch block.
To avoid repetition, i have placed finally block. So is there a way, we can fetch the pipeline data from catch lock too,after exit step is executed?
Is there any other work in the service after the main/finally sequences?
If not, it might be an option to exit from flow and signal failure.
This will cause the flow to exiting immediately.
exit from parent will only exit the main sequence and if there is an getLastError in the Implementation the failure message might be lost for monitoring if it is not handled properly.
I agree with Mahesh about the locations where to put the logout service calls.
Additionally, if your login is inside the try block the session key will not be available in the finally block.