Skip to content

Third-Party MQTT Forwarding

The current platform forwards ThinkLink messages to a third-party MQTT broker through Broker + Forwarder.

There is no per-device third-party forwarding switch, and there is no Server Configuration entry for a third-party platform. Those legacy settings are retired. Configure the Broker records and enable the corresponding Forwarder rule; messages matching its subscription topic are then forwarded automatically.

The typical data flow is:

text
ThinkLink internal Broker (AS or ThinkLink)
        ↓ Source Broker / Subscription Topic
Forwarder rule (optional JavaScript transformation)
        ↓ Target Broker
Third-party MQTT Broker (Customize)

1. Create Broker Connections

Go to Advanced Features → Broker. A forwarding rule normally uses one source connection and one target connection.

Source Broker

Select one of the internal types as required:

  • AS: MQTT messages from the ThinkLink Application Server.
  • ThinkLink: messages processed by the ThinkLink platform.

The platform fills the internal broker address and tenant credentials automatically. You do not retrieve or maintain them under Server Configuration.

Third-Party Target Broker

Create a Customize Broker and enter the connection information supplied by the third-party provider:

  • Name and Enabled status.
  • MQTT URL, such as mqtt://host:1883 or mqtts://host:8883.
  • Username and password when required.
  • CA and client certificates when TLS or mutual TLS is required.

After saving and enabling it, check the Broker list. A successful connection reports RUNNING. If it reports ERROR, inspect ErrMsg and verify the URL, port, credentials, certificates, and network path.

2. Create and Enable the Forwarder

Go to Advanced Features → Forwarder → Add and configure:

FieldDescription
NameForwarding rule name
EnabledThe rule subscribes and forwards only when enabled
Source BrokerBroker to subscribe to
Target BrokerBroker to publish to
Subscription TopicTopic pattern on the source; supports MQTT + and # wildcards
Custom ScriptOptional transformation of the topic, payload, or retain option
Notes / commit messageOptional explanation and version-history note

Once the Forwarder is saved and enabled, every message matching Subscription Topic is sent to Target Broker. No device-side change is required.

Source Broker and Target Broker cannot both be internal AS/ThinkLink types, which prevents an unnecessary internal loop. The common third-party forwarding pair is:

text
Source Broker = AS or ThinkLink
Target Broker = Customize

3. Optional Transformation Script

Without a script, the Forwarder preserves the original topic and message. Use this entry point when the third-party system requires another payload format:

javascript
function forwardScript({ topic, msg, org_params }) {
  if (!msg?.telemetry_data) return null

  return {
    topic: `${org_params.target_topic_prefix}/${msg.device_id}`,
    option: {
      retain: false
    },
    msg: {
      temperature: msg.telemetry_data.T,
      humidity: msg.telemetry_data.H
    }
  }
}

Inputs:

ParameterTypeDescription
topicstringOriginal MQTT topic received by the Forwarder
msgObjectParsed message payload
org_paramsObjectRead-only organization parameters maintained under System Management → Server Configuration → Org Params; this is shared script data, not a third-party forwarding switch or Broker configuration

The returned object supports:

FieldTypeDescription
topicstringTopic published to the target Broker
msgObjectMessage payload to publish
optionObjectOptional MQTT publish settings, such as { retain: true }

Return null, or return nothing, to discard the message.

4. Version History and Public Forwarders

Each saved Forwarder script creates a version snapshot. The editor can show details or restore an earlier snapshot. Restoring creates a new version record and does not delete existing history.

System Platform can maintain public Forwarders. They are visible but read-only on the tenant side. A rule assigned to a specific organization can use that organization's Brokers and org_params. Subscription Topic becomes required after a Source Broker is selected.

5. Troubleshooting Order

  1. Confirm that both Brokers are enabled and the target Broker reports RUNNING.
  2. Check ErrMsg, host, port, credentials, and TLS certificates.
  3. Confirm that the Forwarder rule itself is enabled.
  4. Confirm that Subscription Topic matches the actual message topic.
  5. Temporarily disable the custom script to test transparent forwarding, then inspect the script return value.