Difference between revisions of "MQTT Adapter"
From Datonis
m (MQTT Read Tag) (Tag: Visual edit) |
m (MQTT Adapter Workflow) (Tag: Visual edit) |
||
Line 1: | Line 1: | ||
[[Datonis Edge Gateway|Edge Gateway Home]] > '''MQTT Adapter''' | [[Datonis Edge Gateway|Edge Gateway Home]] > '''MQTT Adapter''' | ||
+ | |||
+ | == MQTT Adapter Workflow == | ||
+ | [[File:MQTT Adapter Workflow.png|alt=MQTT Adapter Workflow|thumb|1052x1052px|MQTT Adapter Workflow]] | ||
== Prerequisite == | == Prerequisite == |
Revision as of 14:00, 5 April 2022
Edge Gateway Home > MQTT Adapter
Contents
MQTT Adapter Workflow
Prerequisite
- MQTT broker should be installed in your setup and accessible to Datonis Edge.
- To install the MQTT broker in Ubuntu you can follow the steps given at https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-ubuntu-18-04. You can generate the certificates required for MQTTS connection using the steps given at http://www.steves-internet-guide.com/mosquitto-tls/
- To install the MQTT broker in Windows, you can download the latest exe file from the official mosquitto site https://mosquitto.org/download/. Then you can follow the steps given at https://bytesofgigabytes.com/mqtt/installing-mqtt-broker-on-windows/. To configure the MQTTS you can follow the steps given at https://bytesofgigabytes.com/mqtt/installing-mqtt-broker-on-windows/.
MQTT Advanced Configuration
You can configure the details about the MQTT broker in the advanced configuration tab. You can set the following configurations in this tab:
Configuration | Type | Description |
---|---|---|
config-json* | JSON | Advanced configuration json to fine tune adapter. |
MQTT Address* | String | The address the MQTT broker listens for incoming connections. Be sure to check if the firewall is configured correctly to allow access to this address. The default value is 0.0.0.0. |
MQTT Port* | Number | The port of the MQTT broker. Be sure to check if the firewall is configured correctly to allow access to this port. The default value is 1883. |
MQTT Secure Port* | Number | The secure transport port of the MQTT broker. Be sure to check if the firewall is configured correctly to allow access to this port. The default value is 8883. |
User Name | String | This is an optional field. The user name is required to access the broker. |
Password | String | This is an optional field. The password is required to connect. If the password is empty, no password will be required to connect. |
Scheduled Thread Pool Size | Number | The server scheduled thread pool is used for most activities on the server-side that require running periodically or with delays. The default value is 3. |
General Thread Pool Size | Number | This general purpose thread pool is used for most asynchronous actions on the server side. The default value is 10. |
Use Integrated MQTT Broker* | Boolean | Switch to enable or disable the usage of the integrated MQTT broker, if disabled(i.e. false) external broker can be used. The default value is true. If it is set to true then we can use the integrated MQTT broker to connect to the other Datonis edge services. |
Client Clean Session* | Boolean | If set to false, the client will continue with the old session and the broker may deliver older messages. The default value is true. |
MQTT Protocol Connection
Configuration | Type | Description |
---|---|---|
Topic Type* | Enum | Topic Type of the connection, DATONIS_SCAN and DATONIS_EVENT can be used to consume data from other Edge Gateways, CUSTOM or CUSTOM_JSON can be used for data from any client. |
Subscribe Topics CSV* | String | Topics to be subscribed to local MQTT broker for this connection. More than one topic can be put via comma separated values, also wild cards + and # are allowed e.g. 'plc/#, plc/vibration/#, plc/+/pressure/#'. |
Message Parsing Script* | String | The default value is 'message_val' i.e. it will pass the message value as it is. All messages would be parsed using this script before passing to the tag script. Context var 'message_val' holds the message, Context var 'message_list' holds the empty list and can be used to return multiple messages for handling collection cases. The return value or non-empty 'message_list' of the script would be passed to all tags. |
Batch Delay (Millis) | String | The default value is 100 milliseconds. Once a message arrives, the Adapter waits for this delay to wait for other messages to become available. All the messages accumulated in a batch would be passed to the tags in one go. If a message for the same topic arrives again then the older message would be ignored. |
MQTT Read Tag
Configuration | Type | Description |
---|---|---|
Tag Id* | String | The unique Tag Id value within a Thing Config object. It is mainly used in metric mappings to map this tag to a thing metric. Only alphanumeric or underscore characters are allowed. |
Match Topics CSV* | String | Topics to be matched for this tag. More than one topic can be put via comma separated values, also wild cards + and # are allowed e.g. 'plc/temperature, plc/+/vibration, plc/pressure/#'. |
Message Parsing Script* | String | The default value is 'message_val' i.e. it will pass the value as it is. Tag messages would be parsed using this script. Context var 'message_val' holds the value returned from the connection message parsing script. The return value of the script would be passed as the tag value. |