The rule engine allows you to configure forwarding rules to forward eligible data reported by devices to TencentDB for MongoDB. After you create an instance in the TencentDB for MongoDB console or through TencentCloud API, device messages can be written to the corresponding TencentDB for MongoDB set.
The figure below shows the entire process of forwarding data to TencentDB for MongoDB by the rule engine:
- Log in to the IoT Hub console and click Rule Engine on the left sidebar.
- Go to the rule engine page and click the name of the rule to be configured.
- On the rule details page, click Add Action.
You will be prompted to authorize access to TencentDB for MongoDB upon the first use. You need to click Authorize Now before you can proceed.
- On the action adding page, select Forward data to TencentDB for MongoDB.
- After successful authorization, you need to configure the TencentDB for MongoDB instance information as shown below. The configuration is divided into the following steps:
1. Select the region and TencentDB for MongoDB instance. If there is no instance under the account, click Create Instance to redirect to the TencentDB for MongoDB console and create one.
- Enter the username of the TencentDB for MongoDB instance (
mongouser by default).
- Enter the login password of the TencentDB for MongoDB instance.
- Enter the name of the database to be written to.
- Enter the name of the set to be written to.
The resending mechanism is used to send the message again in case of a failure in the message forwarding process, which makes sure that the message is received. The details are as follows:
- If message forwarding fails, the system will retry forwarding at intervals of 1s, 3s, and 10s in sequence. If all three retries fail, the message will be discarded.
- If you have configured the "action for forwarding failure", then after three unsuccessful retries, the message will be forwarded again according to the configured action. If forwarding still fails, the message will be discarded.