头图

overview

Triggers are triggered by events to perform actions, for example, cloud functions are triggered when an operation (create, delete, update) is performed on a collection of documents. Using triggers, you can implement business logic more conveniently.

图片

Simple three steps, add trigger

Step 1: Configure triggers

Enter the cloud development CloudBase console and click [Trigger] in the environment bar on the left.

图片

图片

Set the trigger name and select the trigger type: database (currently only supports databases, and will further support cloud storage, scheduled tasks, user status changes and other types in the future).

Determine execution status: You can choose whether the trigger will take effect immediately when it is created successfully.

Step 2: Set the conditions

According to the trigger type, set different types of conditions.

图片

in:

Collection: Select the cloud database collection that needs to be monitored, and the document change in the collection will trigger an event.

Event type: write represents write operation, including update (update), delete (delete), insert (new)

Satisfaction conditions: including "unconditional trigger", "satisfy all of the following", "satisfy any of the following conditions".

图片

The operators supported by the trigger and the field types matched by the operators are as follows:

图片

Step 3: Add actions

The action will be triggered when the trigger meets the trigger condition.

图片

Action type: currently only supports cloud functions, and will further support webhook, SMS and other types in the future.

Trigger frequency:

  • Trigger every time
  • Only trigger once
  • Only trigger once in a period of time (supports setting time interval 6S-30 days)

Tips: Trigger partial restrictions

  1. A single trigger can be configured with 5 actions at most;
  2. The maximum of single trigger data is 256 KB, if it exceeds, it will be discarded;
  3. The single trigger frequency limit is 200 QPS.

The trigger capability is being continuously optimized. Experiences and feedback suggestions are welcome.

Immediately go to the cloud development CloudBase console experience: https://console.cloud.tencent.com/tcb


CloudBase云开发
425 声望438 粉丝

云开发(Tencent CloudBase,TCB)是云端一体化的后端云服务 ,采用 serverless 架构,免去了移动应用构建中繁琐的服务器搭建和运维。同时云开发提供的静态托管、命令行工具(CLI)、Flutter SDK 等能力极大的降...