Tablestore is a distributed NoSQL data storage service that is built on top of the Apsara system. After Tablestore is integrated with Alibaba Cloud Function Compute, Tablestore 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 a scalable serverless web application.

If you are using Tablestore triggers for the first time, you must read Supported regions and Precautions first.

Supported regions

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

Precautions

  • To prevent infinite recursive function invocations, do not use 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 want to access the function specified for the Tablestore trigger over the internal network, you can use a Virtual Private Network (VPC) endpoint: {instance}.{region}.vpc.tablestore.aliyuncs.com. Do not use the internal Tablestore endpoint.
  • 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