Are you excited to explore Apache StreamPipes but find yourself without any sensors to play with? Or maybe you're looking to validate StreamPipes for your use case and kick off a Proof of Concept (PoC) but the hardware is not yet available? No worries—the File Stream Adapter is here to save the day!
With the File Stream Adapter, you can upload a file containing sensor data in various formats (JSON, CSV, XML) and replay this data, giving you a hands-on way to dive into StreamPipes. It‘s not meant for production use, but it’s perfect for experimenting with StreamPipes using your own data.
This blog post will take you on a exciting journey through configuring the File Stream Adapter and using it to simulate sensor data streams.
:::info The adapter supports any type of data as long as it contains a valid timestamp in the form of a Unix timestamp in milliseconds. :::
Let's break down the configuration options for the File Stream Adapter:
yes
(file is replayed once), no
(file is replayed continuously)Keep original time
, Fastest (Ignore original time)
, Speed Up Factor
JSON
, CSV
, XML
, Image
(experimental feature)Let's create a simulation data stream using your own sensor data. First, store the sample CSV data in a local file.
timestamp,density,mass_flow,sensorId,sensor_fault_flags,temperature,volume_flow 1719897720887,41.82,6.306,flowrate01,false,41.9,3.365 1719897721952,45.09,9.659,flowrate01,false,43.2,4.103 1719897722958,42.84,9.532,flowrate01,true,42.6,3.110 1719897723964,49.58,1.929,flowrate01,true,40.3,3.4684 1719897724970,41.83,4.173,flowrate01,false,40.7,0.246 1719897725975,48.11,10.90,flowrate01,false,46.4,5.275
To set up the adapter, follow these steps:
+ New Adapter
.File Stream Adapter
.no
to create an ongoing data stream.Keep original time
to maintain the original event frequency.CSV
, set the delimiter as ,
and check the Header
box.Next
once you've added the correct configuration.timestamp
field and selecting Mark as timestamp
. Save your changes.Next
when done.Adapter Name
.Persist events
box to store the data in the StreamPipes data store.Start Adapter
.Once configured, you should see the following preview:
Now, let's store the entire content of the file in the data lake. Once stored, you can analyze it with the Data Explorer
. Here’s how to configure the adapter:
yes
to read the file only once.Fastest (Ignore original time)
to write data as fast as possible.:::info Ensure the Persist events
checkbox is selected to save the data to the data lake during the Start Adapter
configuration. :::
In this tutorial, we‘ve explored how to use the File Stream Adapter in Apache StreamPipes to create a simulation data stream and persist CSV data into a data lake. This adapter lets you experiment with StreamPipes’ capabilities and explore its functionality using your own data. Happy streaming!