FileExists node in IBM APP Connect V12
FileExists Node:
The FileExists node is the latest node, which is introduced in IBM APP Connect Version 12.0.4.0 onwards. it is used to poll for the existence of a specified file at a specified location, and to delete or leave the file in the file directory without processing the file contents.
From the FileExists node, we can only get the metadata of the last update to the file. We cannot read the contents of the file. The file contents can be read and processed by different file nodes. If the file exists, you have to choose to delete or leave the file in the directory.
The main feature of this node is to know whether the file is present or not in a particular directory. When we compare this node with file input and file read nodes, they read the content from the file and send the data through the Local Environment. In the case of the FileExists node, it only reads the metadata information of the file.
We can get the cache data (metadata) from LocalEnvironment in the flow. The Terminals for the FileExists node are described below:
- FAILURE: It is an output terminal where the message is routed if an error occurs before that message is propagated to our terminal.
- OUT: if the file exists, the out terminal will send the message flow to the next node in the sequence.
- CATCH: if there is an exception in the downstream nodes the message is routed to the catch terminal.
Working With FileExists Node:
- In the above diagram, the File Exists node and file output nodes point to local directories.
- Set the Delete file property as “Never” and the poll property as the default value (5sec). Keep all remaining properties set to default values.
- Change the Message property of compute node to “ALL”. Write the code in compute node to transfer the file metadata, which is present in the local environment and properties.
- Give destination directory for the file output node and set the remaining properties as default
- For example, if we placed the file (NEW.txt) in the FileExists node directory. The flow will trigger as per the poll interval mentioned in the properties. When the flow triggers the Metadata of the file is passed through the local environment which we can observe from the above figure.
- After a successful operation, the file metadata is moved into FileOutput Directory.