Expand | ||
---|---|---|
| ||
|
FilePoller polls for files with the specified name or specified file pattern to move it to a specified directory. It It provides a set of Action that allows to move the files between two directories or it scans the specified directory, checks for an addition of new files or modification of a file and then transfers it from the source directory to the target directoryfor Polling.
Configuration and Testing
microservice Microservice configuration details are provided in this panel. The microservice supports adding multiple configurations with each configuration having the necessary details for polling.
The figure below illustrates the panel with a single configuration (Polling) added.
Figure 1: File Poller Configuration properties
microservice Configuration
Microservice Configuration
Action
It includes three options to choose from depending upon the type of operation:
Move: If selected, matched files will be moved/copied from the source to the destination directory .
Poll: If selected, the directory will be polled for created/updated/deleted files.
- Archive: If selected, matched files will get archived and archived directory gets placed in the destination folder .
Polling Action
It is prompted after choosing the "Poll" option from the Action property. It includes various options to choose files from the directory to poll.
- Create: This option gives the list of files that are created within a given scheduling interval.
- Update: This option gives the list of files that are updated within a given scheduling interval.
- Delete: This option gives the list of files that are deleted within a given scheduling interval.
- All: This option gives the list of files that are created, update and deleted within a given scheduling interval.
- List: This option gives the list of all the matched files with the File Name specified.
Compute Paths relative to Directory
...
The directory which holds the file(s) to be polled/move/archive has to be specified in the Source Directory. All the files in this directory whose names match the pattern specified for the File Name property will be processed.
...
Note |
---|
While specifying the Destination Directory, ensure that you have permissions to create/modify files present in this directory. |
Use Working Directory
This option is shown only if MOVE action was chosen. An absolute path of the destination directory or a path relative to the directory provided in Compute Paths relative to Directory can be specified here.
Working Directory
Shown only when 'Use Working Directory' is enabled. Working directory is used for processing the files, files are copied/moved to working directory temporarily. Files are not copied/moved to working directory.
File name
The name of the file which needs to be polled in the source directory. This property supports patterns such as *.csv and abc *.*, while multiple patterns are not allowed.
Archive File Name
Name of the archived file. This is included only when the Archive functionality is enabled.
Action if same file exist
...
- Overwrite: Overwrites the existing file and hence the old file gets replaced with the new one.
- Rename: Renames the file in the format - "filename + MMddyyHHmmss + counter(optional)" retaining the previously existing files.
Figure 2: Options of Actions in case file name matches
...
Info | ||
---|---|---|
| ||
If this property is set to ".exe" and the file to be moved is named as "installer.exe" in the request, FilePoller ignores that request. |
Include Sub Directory
Files will be searched inside sub directories present inside the source directory. If this option is disabled , only the matching files present inside source directory will be moved/copied.
Info | ||
---|---|---|
| ||
When this property is enabled, Maintain Sub Directory and Sub Directory Regex property (described below) gets displayed |
Sub Directory Regex
By default, the sub directory regex pattern is [A-Za-z0-9_-]*, which searches in all the sub directories for the pattern and includes the sub directories matching the pattern.
Maintain Sub Directory Order
If the matched files are inside the sub directory, then the sub directory order will be preserved in the target directory on moving the file. On disabling this property, matched files which are inside the sub directory get moved/copied to the target directory directly.
Delete After Move/Archive
Enabling this option results in deletion of files from source directory after moving to destination directory. If disabled, files get copied to the destination directory.
Scheduler Service Configuration
...
Functional Demonstration
Scenario 1
Polling for Moving/Copying a specified file set of files in the Source directory and moving it to the Destination directory.
Configure the FilePoller as described in the Configuration and Testing section and use the Display microservice to check the response. In the FilePoller microservice configuration, choose the option "OverwriteMOVE" for the property Action if same file exists.
Figure 5: Scenario demonstration
Sample Input
...
Sample Output
![](/documentation/download/attachments/17891332/Screenshot-12.png?version=2&modificationDate=1501485506000&api=v2)
![](/documentation/download/attachments/17891332/movsamp.png?version=1&modificationDate=1502089605000&api=v2)
Scenario 2
Polling for Archive a specified file set of files in the Source directory and moving it to the Destination directory. If the Destination directory contains the same file, then the target file will be appended with date and time.
Configure the FilePoller as described in the Configuration and Testing section and use the Display microservice to check the response. In the FilePoller microservice configuration, choose the option "ARCHIVE" for the property Action.
Sample Input
Figure 8: CPS configuration when action is set to 'ARCHIVE'.
Sample Output
Scenario 3
Polling a set of files in the Source directory based on the Polling Action chosen.
Configure the FilePoller as described in the Configuration and Testing section and use the Display microservice to check the response. In the FilePoller microservice configuration, choose the option "
...
POLL" for the property Action
...
.
Sample Input
...
Figure
10: CPS configuration when action is set to '
POLL'.
Sample Output
![](/documentation/download/attachments/17891332/Screenshot-13.png?version=2&modificationDate=1501485618000&api=v2)
Figure
11: Output message received
Useful Tips
- The microservice runs on the peer server and therefore the file paths and directories mentioned in the CPS should be valid on the machine where the peer server is running. If the microservice fails over to another peer.
- Ensure that the machine on which the secondary peer server runs have the same path available.