Alibaba Cloud Tablestore is a distributed NoSQL data storage service that is built on top of the Apsara system. Tablestore is integrated with Alibaba Cloud Function Compute and can be connected to Function Compute as an event source. When the data of Tablestore changes, data change information will be used as a parameter to trigger the execution of a specified function. This topic describes how to use Tablestore triggers in Function Compute.

Scenarios

The following figure shows a typical scenario where a Tablestore trigger is used.

scene

The original data from original streams is stored in table A. When the data of table A changes, a function is triggered to enable the Function Compute instance to cleanse table A based on the data change information of table A. Then, the Function Compute instance stores the cleansed data in table B. You can directly read the cleansed data from table B for display. This helps build an elastic and scalable serverless web application.

Before you use the Tablestore trigger for the first time, read Supported regions and Precautions first.

Supported regions

Currently, Tablestore triggers are supported in the following regions: China (Beijing), China (Hangzhou), China (Shanghai), China (Shenzhen), Japan (Tokyo). Singapore (Singapore), Australia (Sydney), Germany (Frankfurt), and China (Hong Kong).

Precautions

  • To prevent infinite recursive function calls, avoid using the following logic to write a function: Table A in a Tablestore instance triggers function B, which in turn updates the data in table A.
  • If you need to gain access to the function specified for the Tablestore trigger over an internal network, you can use a Virtual Private Network (VPC) endpoint: {instance}.{region}.vpc.tablestore.aliyuncs.com. Do not use the internal Tablestore endpoint. For more information, see What is the impact of the VPC feature on availability in China?
  • The execution time of the triggered function cannot exceed one minute.
  • If an error occurs during the execution of the function, the function keeps retrying until the log data in Tablestore expires.

References