Regardless of workflow class, there are two required properties that must be set within the node:
- Topic Template: Enter a string template for the topic on which to publish the message. This must render to a valid topic name, and depending on the selected broker, there may be additional rules around the topic’s format.
- Message Template: Optionally, you may also enter a message to publish on the chosen topic. If no message is entered, or if the string template entered in this field does not resolve to a value, a blank message will be published on the specified topic.
Depending on the workflow class in which the node is being utilized, there are additional configuration options and validation rules.
- Losant MQTT Broker: By default, the message will be published on Losant MQTT Broker. When choosing this option, there are additional rules for the custom topic on which you are attempting to publish your message.
MQTT Integration: Any MQTT Integrations you’ve created in your application are also options for where to publish the message.
- You may enter any valid MQTT topic; it does not have to be a topic you configured for triggering workflows when setting up the integration.
- If the integration is disabled, the node will throw an error.
- If the integration is disconnected, the delivery will occasionally retry for up to one hour. Losant will queue a maximum of 1,000 messages per integration.
Usage of the MQTT Node in Edge Workflows also requires choosing the broker on which to publish the message …
- Losant MQTT Broker: By default, the message will be published on Losant MQTT Broker, and the custom topic rules still apply. Also, if the agent is offline, the message will be queued and will attempt to send again once a connection to the broker is re-established.
- Local Broker: In Gateway Edge Agent v1.17.0 and higher, the GEA’s local MQTT broker is available as an option. You can learn more in the Gateway Edge Agent broker documentation.
Embedded Workflows are a special case: They do not require choosing a broker on which to publish the message. Instead, when the node executes, the Embedded Edge Agent will invoke its
eea_send_message method with the following arguments:
- Topic: The resolved value of the string template entered in the Topic Template field.
- Topic Length: The length, in bytes, of the Topic argument.
- Message: The resolved value of the string template entered in the Message Template field.
- Message Length: The length, in bytes, of the Message argument.
- QoS: The Quality of Service with which this message should be treated. The value is always
It is up to the native code on the device to then send the message through to the Losant MQTT Broker.
Embedded Workflows also take an optional “Return Code Path”, which is a payload path at which the error code returned by
eea_send_message will be placed.
0 is considered successful, and any non-
0value is treated as an error. If a “Return Code Path” is not provided, and
eea_message_received returns a non-
0 value, the node will throw an error and execution of the workflow will stop.
When sending messages to the Losant cloud broker, the MQTT Node has the same throttling and data size limit rules as messages published to the broker directly.
- The node is limited to 30 calls in a 15-second window (per topic) — on average, 2 calls per second.
- Additionally, MQTT Node allows for sending a maximum message size of 256KB to the Losant cloud broker.
Was this page helpful?
Still looking for help? You can also search the Losant Forums or submit your question there.