Configuring the FilePoller Project
The FilePoller project uses a File Poller activity and a Write File activity. This project creates a simple process that points to a specified file. The file is polled periodically to determine whether it was changed. The changed file comprises the text written to a new file.
The
File Poller and
Write File
activities in the
File palette are used in this process.
Before you begin
A text file is required, for example, c:\tmp\fileread.txt. Type a few lines in the file and save it.
- Procedure
- Select and drop a
File Poller activity from the
File palette to the
Process Editor window.
To add an activity to the Process Editor, click the activity and drop it on the Process Editor. Do not drag and drop the activity.
- Select the
Write File activity from the
File palette. Click in the Process Editor next to the
File Poller activity. You see a gray overlay indicating where you can place the activity, along with the transition arrow. When you drop the activity, the transition from the
File Poller activity to the
Write File activity is created.
Note: To create a transition between two activities click the transition icon and join both the activities in the Process Editor.
- Select the File Poller activity. In the Properties tab, select the General tab. Point to the file you created as a prerequisite to this tutorial.
- Select the
Include Existing Files check box. When selected, the
File Poller activity polls the existing file regardless of the changes made. The specified file is periodically polled at the specified interval even if the file has not changed. These changes may pertain to modifying, creating, or removing the file.
Note: The Polling Interval (sec): 5 (default) indicates the Frequency with which the File Poller activity monitors this particular file. Any update to this file is transferred to the output.log file through the Write File activity.
- Save your project. ClickSave button on the tool bar. or the
- Select the Write File activity and click the General tab.
- Click the button in the Filename field and specify the output location, such as, c:\tmp\FilePoller\output.log. Also, select the Create Non-Existing Directories check box.
- Click the
Input tab to specify input to the
Write File activity. Drag the
FilePoller\fileContent\textContent from the
Data Source pane into the
textContent field in the
XPath Expression pane. This writes the content of the polled file to the output file.
- Save your project.
- Test this project in the debugger. For more information about the testing procedure, see Testing the File Poller Application in Debugger.
ResultThe
File Poller activity polls the
fileread.txt file located in
c:\tmp file every 5 seconds and any changes made to the file content are written to the
output.log file at
c:\tmp\FilePoller by the Write File activity.