Data Bridge
Overview
The data bridge connects FastBee with external data systems. It can integrate with MQTT servers, HTTP services, and relational databases such as MySQL, SQL Server, Oracle, and PostgreSQL.
With the data bridge, users can forward messages from FastBee to external systems in real time, or pull data from external systems and publish it to specified MQTT topics. Combined with rule scripts, data processing and distribution can be completed without writing additional backend code.
Bridge input supports:
- Product-level events such as device online/offline, device reporting, and platform command delivery.
- Data-flow input through HTTP access or MQTT topic subscription.
Bridge output supports:
- Built-in MQTT republishing.
- Publishing to an external MQTT server.
- Sending data to third-party HTTP OpenAPI endpoints.
- Inserting data into relational databases through SQL.
Warning
Input and output can be used together, making data forwarding and stream processing more flexible.
Bridge Input
HTTP Input
FastBee provides fixed HTTP access routes such as /bridege/get, /bridege/post, and /bridege/put. Authentication uses a JWT token. Create a system authorization token and include it in the request header.
Operation path:
Data Bridge -> Add
Select input direction -> Select HTTP bridge -> Select access route
Rule Script -> Add
Select HTTP input -> Select HTTP bridge access point -> Edit script contentMQTT Input
Operation path:
Data Bridge -> Add
Select input direction -> Select MQTT bridge -> Enter server configuration and bridge topic
Rule Script -> Add
Select MQTT input -> Select MQTT bridge access point -> Edit script contentBridge Output
Built-In MQTT Republishing
After data enters the platform, a rule script can adjust the republished topic, payload format, and calculation logic, then publish the message back to the internal MQTT server for business processing.
External MQTT Server Output
- Create an MQTT bridge configuration: Rule Engine -> Data Bridge -> Add.

Configuration fields:
- Bridge name: the configuration name.
- Bridge direction: output.
- MQTT server address: address and port, for example
fastbee.cn:1883or101.33.237.12:1883. - Client ID: MQTT client ID, for example
S&D1LN0D9DN5X6&205&1. - Username and password: credentials for connecting to the MQTT server.
- Bridge route: can be empty for output direction.
After adding the configuration, use the connection test button to verify whether the MQTT client can be created successfully.

- Create an MQTT output script: Rule Engine -> Rule Script -> Add.



- Test the script with MQTTX by selecting the product and device associated with the rule script and simulating device reporting.

The following screenshots show local device data bridged to the FastBee demo site. Both platforms can receive the reported data through the MQTT bridge.


HTTP OpenAPI Output
FastBee Configuration
Create an HTTP bridge configuration from Rule Engine -> Data Bridge -> Add.

Configuration fields:
- Bridge name: configuration name.
- Bridge direction: output.
- Request method: choose
GET,POST, orPUTaccording to the target API. - Bridge address: full API URL, for example
http://localhost:18083/api/v5/metrics. - Request headers: add target API authentication parameters, such as
Authorizationandapplication/json. - Request parameters and body: configure according to the target API document.
Create an HTTP bridge output rule script:



Output Test
Use MQTTX to simulate device data reporting and verify backend logs.


Third-Party Integration References
EMQX
Reference documentation: https://www.emqx.io/docs/en/v5.1/admin/api.html
- Create an API key in the MQTT server.
- Use HTTP Basic authentication or Bearer authentication according to the target API.
- Create the corresponding HTTP bridge configuration in FastBee.



Ezviz
Reference documentation: https://open.ys7.com/help/81
Common HTTP parameters include Content-Type: application/x-www-form-urlencoded and accessToken.



OneNET
Create the required API credentials on the OneNET platform and configure the matching request headers and parameters in FastBee.



Baidu AI Cloud
Reference documentation: https://cloud.baidu.com/doc/EVS/s/Ekowke5c8
- Create an application.
- Obtain
access_token. - Configure
Content-Type: application/json; charset=utf-8and the required token parameters.



Hikvision API
Register an account on the Hikvision platform, obtain ak, sk, and token information, then configure the request headers in FastBee.



For other platforms, follow the API document of the target platform and map authentication, headers, parameters, and body fields to FastBee bridge configuration.
Database Storage
Create Database Storage Configuration
Create a database storage bridge from Rule Engine -> Data Bridge -> Add.

Configuration fields:
- Bridge name.
- Bridge direction: usually input.
- Database type: relational databases are currently supported.
- Data source: MySQL, Oracle, SQL Server, PostgreSQL, and similar databases.
- Connection address: IP and port, for example
localhost:3306. - Username and password.
- Database name.
- SQL statement.
Example:
INSERT INTO database_storage(topic, payload, serial_number, product_id, protocol_code)
VALUES ('${topic}', '${payload}', '${serialNumber}', '${productId}', '${protocolCode}');Custom values can be set in the rule script and referenced in SQL, HTTP body, or other output templates:
msgContext.setData("test", 1);Warning
When using custom placeholders such as ${field} inside SQL values, keep single quotes for string values to avoid SQL errors.
Create Database Storage Rule Script
Create a rule script from Rule Engine -> Rule Script -> Add.

The following fields are already encapsulated by the backend and can be omitted unless custom SQL requires additional values:
msgContext.setData("topic", NewTopic);
msgContext.setData("payload", NewPayload);
msgContext.setData("serialNumber", serialNumber);
msgContext.setData("productId", productId);
msgContext.setData("protocolCode", protocolCode);Test Database Storage


