MQTT Pub¶
The MQTT Pub node establishes an MQTT client that pushes data to a third-party MQTT server.
Node Type¶
External.
Input and Output Ability¶
This node has multiple entry points and can have 0 or 1 exit point. Both the input and the output can be any format.
The topic to publish to is stored in the metadata of the output msg, which can be retrieved using the expression ${metadata.topic}
.
Node Properties¶
Provide MQTT Details
From Server Configurations
Name
The name for this node.
Configuration Method
The method to configure the MQTT server. Configuration methods include the below.
Provide MQTT Details: Configure from scratch. If selected, the following fields are required.
Host: The URL of the MQTT server.
Port: The port of the MQTT server.
Authentication Method: The method by which the request made by this node is authenticated. Values include the below.
Anonymous: Does not need any authentication.
Username/Password: Pass the username/password in the request for authentication. If selected, the following fields are required.
User Name: The user name the client uses to log in to the server.
Password: The password the client uses to log in to the server.
Uni-directional: Use encrypted communication where the MQTT client authenticates the credential obtained from the server. If selected, the following is required.
Certificate: The certificate from the server that the MQTT authenticates.
Bi-directional: Use encrypcted communication where the MQTT client and server both authenticate each other’s credentials. If selected, the following is required.
Certificate: The certificate from the server that the MQTT authenticates.
Client Certificate: The client certificate to be authenticated by the MQTT server.
Client Certificate Key: The client certificate key to be authenticated.
Client Password: The client password to be authenticated.
From Server Configurations: Select a pre-configured MQTT server from the drop-down. For more information, see Server Configurations.
Topic
The topic to publish to. You can specify only 1 topic.
QoS
The highest QoS (Quality of Service) level that can be used to publish messages to the MQTT server. The table below shows the 3 QoS levels from low to high (0 to 2). Select a level as per required. The default value is 2.
QoS |
0 |
1 |
2 |
---|---|---|---|
Server (Producer) |
Only 1 message will be sent. It will not be stored nor acknowledged. |
At least 1 message will be sent and acknowledged. The server will resend the message if it does not receive any acknowledgement. |
Only 1 message will be sent, stored, and acknowledged twice. The server will delete the message from the queue after the second acknowledgement. |
Client (Consumer) |
Only 1 message will be received, or not at all. No acknowledgement will be returned. |
At least 1 message will be received. The client will return 2 acknowledgements when it receives the message. |
Only 1 message will be received. The client will return an acknowledgement when it receives the message. The transmission will be completed after the second acknowledgement. |
Advantage |
Fastest and uses the least resources. |
The performance is the best and the message will not be lost. |
Guarantees that each message is received only once and will not be lost. |
Disadvantage |
The message may be lost. |
The client may receive the same message multiple times. |
Slowest and uses the most resources. |
Recommended Scenarios |
|
|
|
Clear Previous Sessions
Clear the previous sessions between the client and server whenever the client reconnects to the server.
Description
The description for this node.
Test Connection
You can click the Test Connection button to test the MQTT connectivity.
Limitations¶
Maximum node entry points: 100
Number of connections: 1
Maximum number of topics: 1
As the MQTT server is not managed by EnOS, connection problems could occur due to server downtime or other instances that are not within our control.
Samples¶
Input Sample¶
Example of a JSON object as input:
{
"MetaData": {},
"Body": {
"externalId": "externalId",
"timestamp": 24214324324,
"measurepoints": {
"speed": 32,
"heat": 40
}
}
}
Output Sample¶
{
"MetaData": {
"topic": "officeTemp"
},
"Body": {
"externalId": "externalId",
"timestamp": 24214324324,
"measurepoints": {
"speed": 32,
"heat": 40
}
}
}