Example: Create a Data Source and a Stream Application
-
Open the Data Sources menu under Stream Processing.
- To set this Data source to be only visible to you and to no one else, select the folder My Workspace.
-
Select + New Data Source.
- Enter a name for the new data source and click Create.
- Select the Connector drop-down.
-
Select MQTT in the Input section of the drop-down
list.
-
Update the broker URL to be
tcp://mqtt.swx.altairone.com:1883
-
Populate the Topic field with the MQTT topic of the AnythingDB
Thing from which you want to process data. This should be in
the format
spaces/<space>/things/<thing_id>/properties-history/+
- Populate the User Id and password. These can be found on the Interfaces tab of the Details page of the Thing you are trying to connect to. Detailed information can be found here
-
Select Generate Columns.
Note: Your device must be sending Data to generate columns. If Stream Processing does not detect any messages within the limit, it will timeout.
-
Select Save.
The input data sources has been successfully created.
- Go back tot he main view and select +New Data Source.
- Enter a name for the new data source and click Create.
- Select the Connector drop-down.
- Select JDBC Legacy in the Output section of the drop-down list.
-
Enter the following information:
- Choose URL: This should be in the format jdbc:postgresql://Server/DatabaseName
- User Id and Password: From your PostgreSQL Database
- SqlDialect: choose PostgreSQL from the drop-down
- Table: enter the name of the table defined in your PostgreSQL database
-
Click the + button to start adding the source parameters (received via MQTT)
and the target parameter (defined in your PostgreSQL database).
-
Click Save.
The output data source has been successfully created.
- Move to the Applications tab and click + New Application.
-
Choose to add an Input operator. From the Data Source drop down menu, choose
the MQTT input data source created earlier.
- Repeat the same process to add an output operator and an input operator, and choose from the data source drop-down from the JDBC output created earlier.
-
Click Save and Run. Check how the
data is being stored in your external PostgreSQL Database.