Talend tWaitForFile insufficiency

岁酱吖の 提交于 2019-12-08 08:07:48

问题


We have a producer process that write files into a specific folder, which run continuously, we have to read files one by one using talend, there is 2 issues:

  • The 1st: tWaitForFile read only files which exist before its starting, so files which have created after the component starting are not visible for it.
  • The 2nd: There is no way to know if the file is released by the producer process, it may be read while it is not completely written, the parameter _wait_release_ of tWaitForFile does not work on Linux system !

So how can make Talend read complete written files from a directory that have an increasing files number ?


回答1:


I'm not sure what you mean by your first issue. tWaitForFile has options to trigger when files are created, modified or deleted in a folder.

As for the second issue, your best bet here is for the file producer to be creating an OK or control file which is a 0 byte touch when it has finished writing the file you want.

In this case you simply look for the appearance of the OK file and then pick up the relevant completed file. If you name the 2 files the same but with a different file extension (the OK file is typically called ".OK" then this should be easy enough to look for. So you would set your tWaitForFile to look for "*.OK" files and then connect this to an iterate to a tFileInputDelimited (in the case you want to pick up a delimited text file) and then declare the file name as ((String)globalMap.get("tWaitForFile_1_CREATED_FILE")).substring(0,((String)globalMap.get("tWaitForFile_1_CREATED_FILE")).length()-3) + ".txt"

I've included some screenshots to help you below:



来源:https://stackoverflow.com/questions/21831756/talend-twaitforfile-insufficiency

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!