Hi All,
I have a requirement like i need to transfer file(s) from one host to another host using a flow service. In that service after each file get transferred successfully to the target host i need to verify that the file (data) is not lost in transmit(to confirm that file is not partially transferred). How do i do that? Has anyone implemented this kind of scenario.
Thanks a lot in advance. I posted in so many wM realted forums but all gone in vain.
How to confirm the transmission will depend on the communication protocol you use.
If you are using the FTP services, one approach is this:
Login to the FTP server.
Put the file to the server, using a unique name to avoid filename conflicts. Also, use a file extension that the FTP server side treats as “in progress” such as .tmp.
Once you finish sending the file contents (use streams to avoid loading the entire file into memory) rename the file to change or remove the .tmp extension. This indicates that the file is complete and ready to be picked up. This works because renames, even in FTP sessions, are atomic operations. They either succeed or fail and if they succeed, the file is good to go.
Check for errors at each step (login, put, rename, etc.). If all steps work, then you’ve successfully and completely sent the file.
As an alternative to using a file extension, the FTP server can provide a “work” directory. You put the file to that directory and when finished, rename the file to move it to the desired directory for pickup. Renames can move a file too, without trouble (as long as the directories are on the same drive).
Iam exactly doing like what you posted. But it working abnormally some times by transferring partially(very rare) and we can’t replicate this scenario. But the return message is success status only whether it is complete file transfer or partial transfer. How to handle this situation? Any suggestions would be greately appreciated.
Which of the pub.client FTP services are you using? If you’re using the pub.client:ftp service you may want to instead use the individual services in pub.client.ftp for complete control.