Scenario: Ingesting Live Data from an External Broker
Subscribe to an external MQTT broker, transform gateway and HVAC messages in Node-RED, and ingest them into OCI IoT.
Use this scenario when devices or gateways already publish telemetry to an external MQTT broker. The flow is MQTT-IN -> Function -> MQTT-OUT, with an optional Debug branch.
Tasks
Prerequisites
- Complete the common scenario setup before starting. The example receives data from
test.mosquitto.org:8883, converts public topics to the adapter topics, and publishes to the OCI IoT device host. - A private subnet with a route through a NAT gateway for
0.0.0.0/0, or another approved route that lets the runtime reach the external broker. - Network security rules that permit outbound TLS connections to the broker on TCP port
8883and to the IoT device host. - The gateway device password and the IoT domain device host.
- The MQTTX connection described in the common setup.
If you need to create network resources, see Creating a VCN, Creating a Subnet, Creating a NAT Gateway, Creating a VCN Route Table, and Creating an NSG.
Creating the Flow Runtime
Configuring the Node-RED Flow
Publishing Test Messages
Troubleshooting
- Verify the broker host, port
8883, TLS trust, subscription topic, QoS, and authentication values. - Use a unique MQTT client ID for each Flow Runtime. Shared runtimes must use the same
$share/fr-guide/source/+/+topic but different client IDs. - Confirm that MQTT-OUT uses the domain device host, the gateway external key as the username, and the gateway device password.
- Confirm that the gateway message reaches the device host on
dataand HVAC messages usehvacs/<external-key>. - Confirm that each HVAC external key exactly matches an active indirectly connected device associated with the gateway.
For more information, see Troubleshooting IoT Flow Runtimes.
FAQs
- Does the external broker send data directly to OCI IoT?
- No. MQTT-IN subscribes to the external broker, the Function node transforms the topic and message, and MQTT-OUT publishes the result to the IoT domain device host.
- Why does the flow rewrite the MQTT topic?
- The public topic identifies the source device. The gateway and HVAC adapters expect the IoT device-host topics
dataandhvacs/<external-key>. - When should I use the shared-subscription topic?
- Use
$share/fr-guide/source/+/+when two or more Flow Runtimes should divide messages in one subscription group. Usesource/+/+for one runtime. - Can I use a different MQTT broker?
- Yes. Replace the broker connection values and configure the required TLS, authentication, DNS, routes, and security rules for that broker.