Simulator Source Connector
stream sourcescan table source
Simulator source provides a way to generate data for testing and demo purposes. It can be used to simulate a stream of data from a device or sensor. User can define the mock data content and the sending interval.
The default simulator source configuration can be found at
$ekuiper/etc/sources/simulator.yaml. It defines the mock data and the interval to generate the data.
- temperature: 22.5
Users can specify the following properties:
data: The mock data to be sent. It is a yaml struct. The key is the field name and the value is the field value. It can also be a list of yaml struct. The connector will send the data in the list one by one.
interval: The interval in milliseconds to generate the data.
loop: Whether to loop the data. If set to true, the connector will send the data in the list one by one and then start from the beginning again. If set to false, the connector will stop after sending all the data in the list.
Create a Stream Source
Having defined the connector, the next phase involves its integration with eKuiper rules.
You can define the Simulator source as the data source either by REST API or CLI tool.
Use REST API
The REST API offers a programmatic way to interact with eKuiper, perfect for users looking to automate tasks or integrate eKuiper operations into other systems.
STREAM mock_stream () WITH (TYPE="simulator");
More details can be found at Streams Management with REST API.
For users who prefer a hands-on approach, the Command Line Interface (CLI) provides direct access to eKuiper's operations.
Navigate to the eKuiper binary directory:bash
createcommand to define a stream for the Neuron source connector:bash
./kuiper create stream mock_stream ' WITH (TYPE="simulator")'
More details can be found at Streams Management with CLI.