Example

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.

Refer to configuration to understand all configuration options of this Agent.

Step 1: Add the Agent

Drag the CSV Listener onto the canvas and rename the Agent. Link the output endpoint to the printer, and save the Data Stream.

Step 2: Configure General

Select the Agent and click Configure. Keep the default Collection and type 5 for the polling interval.

Step 3: Configure Data

Select the source CSV file or drag it onto the File field. The CSV definition is pre-populated with the headings.

Step 4: Configure Payload

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.

Step 5: Results

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.

Files

See the Import, Export, and Clone - XMPro article for steps to import a Data Stream.

Last updated