Edge Agent Broker

The Edge Agent exposes a local MQTT broker to be used for local machine-to-machine (M2M) communication, or to trigger Edge Workflows using the MQTT Trigger to process and forward sensor data to the cloud.

If the devices need to connect directly to the cloud, you can use Losant’s Cloud MQTT broker. The agent broker is to be used for local communication between the agent and edge devices with MQTT clients built-in.

For example, you can use the Edge Agent’s MQTT broker to enable the agent to communicate with MQTT-enabled PLCs on the same network as the agent. The Edge Agent’s MQTT broker supports a wide range of configuration options.

Edge Agent Support

The agent’s local MQTT broker is only supported in Edge Agent versions 1.17.0 or higher.


By default, the local MQTT broker is disabled and must be enabled through the Edge Agent configuration. See LOCAL_BROKER_ENABLED.

If enabled, the local MQTT broker can be used to subscribe and publish to topics through an Edge Workflow with the MQTT Trigger and MQTT Output Nodes.

System Topics

Publishing to $SYS topics is reserved for automatic system messages, these messages are published by the broker when certain events occur and do not contain a clientId.

The following $SYS topics are currently used by the broker:

  • $SYS/broker/new/clients: Publishes a clientId whenever a client connects.
  • $SYS/broker/disconnect/clients: Publishes a clientId whenever a client disconnects.
  • $SYS/broker/heartbeat: Health signal every 60 seconds.

Connecting to the Cloud Broker

To connect the Edge Agent’s broker to the Cloud Broker, you must do so explicitly using an Edge Workflow. This can be done by using the MQTT Output Node that’s connected to the cloud broker.


The following options can be used to configure the Edge Agent Broker. A full list of all configuration options for the Edge Agent can be found here.

Environment Variable Configuration File Option Command Line Flag
LOCAL_BROKER_ENABLED localBroker.enabled --local-broker-enabled
LOCAL_BROKER_PORT localBroker.port --local-broker-port
LOCAL_BROKER_ADDRESS localBroker.address --local-broker-address
LOCAL_BROKER_USERNAME localBroker.username --local-broker-username <username>
LOCAL_BROKER_PASSWORD localBroker.password --local-broker-password <password>
LOCAL_BROKER_SSL_KEY_PATH localBroker.ssl.keyPath --local-broker-key-path <path>
LOCAL_BROKER_SSL_CERT_PATH localBroker.ssl.certificatePath --local-broker-cert-path <path>
LOCAL_BROKER_SSL_BUNDLE_PATH localBroker.ssl.bundlePath --local-broker-bundle-path <path>

Example Configuration

The following is an example of the Edge Agent Broker in a configuration file:

# If the local MQTT broker should be enabled - CLI: --local-broker-enabled, EnvVar: LOCAL_BROKER_ENABLED
# enabled = false

# Port to run the local MQTT broker on - CLI: --local-broker-port, EnvVar: LOCAL_BROKER_PORT
# port = 1883

# Address to run the local MQTT broker on - CLI: --local-broker-address, EnvVar: LOCAL_BROKER_ADDRESS
# address = ''

# Username for the local MQTT broker - CLI: --local-broker-username, EnvVar: LOCAL_BROKER_USERNAME
# username = ''

# Password for the local MQTT broker - CLI: --local-broker-password, EnvVar: LOCAL_BROKER_PASSWORD
# password = ''