...
This helps the component to determine the type of dialog to be shown while providing the paths of Source Directory, Working Directory and Error Directory (these directories are described in the next sections below). When both the Peer Server and the Studio are running on the same machine, the paths to the above-specified directories can be chosen from a file dialog with the directory structure of the current machine. Otherwise, the absolute path of Source/Working/Error directories must be specified in the text field.
...
Note |
---|
|
...
Let, C:\test.txt be the file picked up for processing. With this configuration, the command formed by FileReader would be C:\copyerrors.bat C:\test.txt C:\ProcessingFailures. The copy command executed finally would be copy copying C:\FileReader\ErrorDir C:\ProcessingFailures which will move all the files present in C:\FileReader\ErrorDir to the backup location C:\ProcessingFailures.
...
The directory to which files are to be moved when after they are read successfully, when MOVE is selected as the Postprocessing Action.
If Is configured on different machine? is disabled, clicking the ellipsis button will open a file dialog, as shown in Figure 3, where the directory can be chosen from the file system. Otherwise the path of the directory must be specified in the text field as shown in Figure 2.
...
Note |
---|
|
...
- If selected, a counter is appended to the file name filename of each processed file in addition to the time stamp. Appending counter to file names ensures that no two files in the Postprocessing directory will have same name. The name of the file would look like <filename><time stamp><counter>.
...
Type of the file processed | Header property | Description | |
---|---|---|---|
Flat/Binary
| FileName | Name of the file being read. | |
FilePath | Path of the directory which holds the source file. | ||
Size | The size of the file being read. | ||
START_EVENT | An output message with this property set to true determines that the message is the first record in the set of responses generated for an input message.
| ||
CLOSE_EVENT | An output message with this property set to true determines that the message is the last record in the set of responses generated for an input message.
| ||
RECORD_INDEX | A value n for this property indicates that this is the nth response generated for an input message. | ||
Flat
| FullName | Absolute path of the processed file. | |
ReadAccess | Determines if the processed file is readable. | ||
WriteAccess | Determines if the processed file is writable. | ||
Type | File / Directory. | ||
Binary
| NEW | An output message with this property set to true determines that this is the first chunk of the binary file being read. | |
COMPLETE | An output message with this property set to true determines that this is the last chunk of the binary file being read. | ||
START_INDEX | Determines the offset of the first byte of the current chunk read. | ||
END_INDEX | Determines the offset of the last byte of the current chunk read. |
...
Figure 11: Property to choose order of files in which they will be processed
Process Files in Order Based On
...
Values returned after applying the pattern on file names. Values can be of the following types:
- Int
- Long
- String
- Date
Connection Timeout property
It is recommended to add the following value in Runtime Arguments in the Properties pane, which represents the maximum time that component waits for execution of each file:
Code Block | ||||
---|---|---|---|---|
| ||||
-DCONNECTION_TIMEOUT=3000 |
After enabling this, if a CONNECTION_ERROR is thrown while the request is expecting to read N number of files, then the execution of all the remaining files for that request will be discarded. Once the CONNECTION_ERROR has occurred, the next request from the input port is processed in sequence order.
Figure 12: Configuring the runtime arguments by editing the JVM_PARAMS value to manage memory
Input and Output
Input
When FileReader is not in scheduling mode, messages can be sent onto the input port of the component specifying the file to be read and the location of the file. The schema of the input XML message is shown in Figure 10.
Figure 1213: Schema of the input message
- FileName is the name of the file which is to be read.
- Directory is the location of the file.
...
Interaction configurations can be tested from the CPS by clicking the Test button. Below figures show the sample input and the corresponding output respectively.
Figure 1314: Sample input
Figure 1415: Output produced for sample input shown in Figure 10
...
Reading simple text files and displaying the contents.
Configure the FileReader as described in Configuration and Testing section and use feeder and display component to send sample input and check the response respectively.
Figure 1516: Demonstrating scenario 1 with sample input and output
...
Contents of the input file appears appear here.
Use Case Scenario
In a revenue control packet scenario transaction files are read and then transformed.
Figure 1617: Revenue Control Packet Scenario
...
Tip |
---|
To understand the service better, refer the REST Attachments example whichwhich demonstrates FileReader service features. |