Skip to content

Commit 3c4ba66

Browse files
committed
Add MQTT controller
1 parent 235d4cb commit 3c4ba66

File tree

7 files changed

+651
-13
lines changed

7 files changed

+651
-13
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ In order to configure the source, set the following variables:
5252
| PG_MAX_CONNECTIONS | Max connections in the Postgre connection pool. |
5353
| TABLE_MAPPING_FILE | Path to the tables mapping file. Explained below. |
5454

55+
For MQTT real-time inserts, configure the following variables:
56+
57+
| Variable Name | Description |
58+
|---|---|
59+
| MQTT_URL | Connection URL for MQTT server. Example: `mqtt://test.mosquitto.org` |
60+
| MQTT_USER | Username for MQTT authentication (if required) |
61+
| MQTT_PASSWORD | password for MQTT authentication (if required) |
62+
5563
In order to configure the table mapping rules, create a JSON file and set its path into the `TABLE_MAPPING_FILE` variable.
5664

5765
The tables mapping file contains an array with the following structure:
@@ -68,7 +76,17 @@ The tables mapping file contains an array with the following structure:
6876
"name": "Feature name. Name of the field in the database",
6977
"type": "Feature type. Can be: NOMINAL, NUMERIC, LOGIC, DATE or TEXT"
7078
],
79+
80+
"topic": "Name of the MQTT topic to subscribe to."
7181
}
7282
]
7383
```
7484

85+
For each table you can set a MQTT topic in order to listen for new instances. Those instances are expected as JSON objects, being the keys the names of the fields. Example:
86+
87+
```json
88+
{"sepallength":6.9,"sepalwidth":3.1,"petallength":5.1,"petalwidth":2.3,"species":"virginica"}
89+
```
90+
91+
92+

0 commit comments

Comments
 (0)