Define the new stream and operator details
Now, you need to define the schema for the stream from the DirectoryScan and tell that operator where to look for files. The Observations operator now gets its instructions from an input stream rather than a static parameter, so you have to adjust its configuration. Finally, you need to tell the Throttle the desired flow rate.
The DirectoryScan operator’s output port supports only one schema: a single attribute of type rstring, which will hold the full path to the file. You can call that attribute anything you like.
- Select the output stream from DirectoryScan_4 and rename it to
- In the Schema tab in the Properties view, click the first Name field (placeholder varName) and enter
- Press the Tab key to move to the next field (placeholder varType) and enter
rstring. Remember to use content assist (Ctrl+Space) to reduce typing and avoid errors. Press Enter.
- In the editor, select the DirectoryScan_4 operator. In the Properties view, go to the Param tab and set the directory parameter to the value
"/home/streamsadmin/data". Remember to include the double quotation marks.
- Rename the operator (to
Files) by removing its alias.
A FileSource operator knows which file or files to read either from a static parameter (called file) or from the tuples coming in on an input stream, but not both. Now that you are getting file names from a DirectoryScan operator, that file parameter you used previously is no longer needed. You’ll get an error if you keep it.
- Select the Observations operator in the editor. In the Properties view (Param tab), click the file parameter and then click Remove.
The Throttle operator has a mandatory parameter for specifying the desired flow rate. It is a floating-point number with a unit of tuples per second.
- In the editor, select Throttled.
- In the Properties view (Param tab), click the Value field next to the rate parameter and enter
40.0. The decimal point is necessary to indicate a floating-point value.
- Save. There should be no build errors.