“Before Rename the file , I pass the file to TN.It will need some time.”
This is common in processes that can take a bit of time. The key is to not keep the FTP connection open while TN/IS is doing its work. The easiest way to do this is to configure the processing rule to be async. Here are the high-level steps:
Your service wakes up and retrieves the document via FTP.
Submits the document to TN.
TN persists the document to the DB and then evaluates which processing rule to use.
If the rule is async, it will create a thread and invoke your IS service in that thread.
Control returns to your service with TN status.
You can rename the file.
The key is in having TN return control to your service as soon as the document/file has been persisted. Then you know you have safely pulled and stored the document and can tell the FTP server ‘got it’.