This example Data Stream demonstrates how to use this Listener to simulate pump readings using data from a CSV file. The pump readings could later be combined with contextual data.
Drag the CSV Listener onto the canvas and rename the Agent. Link the output endpoint to the printer, and save the Data Stream.
Select the Agent and click Configure. Keep the default Collection and type 5 for the polling interval.
Select the source CSV file or drag it onto the File field. The CSV definition is pre-populated with the headings.
Adjust the data types which are not String: set DateTime for TimeStamp, Long for WaterTemperature, and Double for FlowRate.
Tick Repeat events after reaching end of file to loop the records after reaching the end of the source CSV file.
Tick Include current time in the output to include a timestamp in the output payload.
Apply the changes, save the Data Stream and publish it.
Let’s look at the Live Data View. Every 5 seconds, an event is generated using data from a row from the file. Current Timestamp is appended to the event because we ticked Include current time in the output. The file contents loop because we ticked Repeat events after reaching end of file.
CSV Listener Example.xuc