Last Updated on : 2024-08-14 02:17:23download
Different from the business data channel topic ${clientId}/out/event, Pulsar notifications use an independent Pulsar channel, topic ${clientId}/out/notice, which is not affected by the business channel and can receive various high-priority non-business events in near real time.
For example, if a backlog alarm is triggered for the ${clientId}/out/event topic, Tuya will send an alert message to the Pulsar topic, making it easier for you to handle the event subsequently. Compared to SMS and email alerts, Pulsar notifications are more flexible.
Log in to Tuya Developer Platform.
Find your target project and click Open Project in the Operation column.
On the Message Service tab, turn on the Enable switch.
In the pop-up window of Configure Message Service, select Subscribe to Pulsar Alert, set the threshold and interval for backlog alerts, and click OK.
The settings above enable the system to send a Pulsar alert message to you every 15 minutes when the number of messages accumulated in the topic ${clientId}/out/event is greater than 2,000 until the number does not exceed the threshold of 2,000.
The data signature and message format are the same as those of the topic ${clientId}/out/event. For more information, see Data Signature.
Business Module | Protocol Number | bizCode | eventType |
---|---|---|---|
Topic Backlog Alarm Notification | 10000 | HighPriorityNotice | pulsar_backlog_notice |
bizData
Data Body Description
Code | Data Type | Description |
---|---|---|
eventType | String | Event type |
eventData | JSON | Backlog information |
eventData
Data Body Description
Code | Data Type | Description |
---|---|---|
dataCenter | String | Data center of backlog |
topic | String | Topic of backlog |
subscription | String | Name of subscriber for backlog topic |
backLogNum | Integer | Number of accumulated messages |
Sample
{
"bizCode": "HighPriorityNotice",
"bizData": {
"eventData": "{\"dataCenter\":\"AY\",\"topic\":\"****/out/event\",\"subscription\":\"****-sub\",\"backLogNum\":2004}",
"eventType": "pulsar_backlog_notice"
},
"ts": 1722432061033
}
Change the topic in the SDK to ${clientId}/out/notice to receive Pulsar messages. When there is a backlog, Tuya will send messages to developers. For more information, see Best Practices.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback