You need to enable JavaScript to run this app.
Volcano Engine Function as a Service

Volcano Engine Function as a Service

Copy page
Download PDF
Trigger management
Creating TOS triggers
Copy page
Download PDF
Creating TOS triggers
veFaaS can be integrated with TOS of Volcano Engine. After you create a TOS trigger, veFaaS can listen to changes in various events under a specified bucket, and pass the events to the user function. This triggers function code execution. You only need to write the function that processes the events without the need to worry about the details of how veFaaS obtains events. This topic describes how to create TOS triggers.​
Background information​
  • How the TOS trigger works and precautions​
  • When a TOS event that meets specified conditions occurs, TOS sends the event to veFaaS, which writes the event to a queue and quickly returns a response to TOS to indicate that the event has been received. Subsequently, an independent process reads the event from the event queue and triggers the function to execute user-defined business processing logic.​
  • Maximum number of retries on error: 10 times, after which the event will be discarded. If the function execution returns an error, for example, the function handler directly returns an error or a status code that is equal to or greater than 400, veFaaS will perform retries, and you do not need to write retry logic in your code.​
  • Maximum event retention duration: 6 hours, after which the event will be discarded. Properly configure the concurrency per instance and the maximum number of instances. This ensures that the function has sufficient performance and resources to handle event notifications.​
  • Message repeated delivery: Due to the eventual consistency characteristic of the event queue, the same event may be repeatedly delivered to the function. Make sure that your function code can handle duplicate events as expected.​
  • A TOS trigger is a two-way integrated trigger​
  • Each time a TOS trigger is created on the veFaaS side, an event notification rule with the same name will be synchronously generated on the TOS side. Correspondingly, each time an event notification rule is created on the TOS side, a TOS trigger with the same name will be synchronously generated under the target function on the veFaaS side.​
  • A single TOS event can be delivered to multiple functions​
  • If you have such a requirement, go to the TOS console to create an event notification rule. For detailed operations, see Configuring event notifications.​
Prerequisites​
  • A function has been created based on the vefaas-python38-default template or the vefaas-golang-tos-trigger template, and has completed at least one full release. For detailed operations, see Releasing functions.​
  • A TOS bucket has been created. For detailed instructions, see Creating buckets.​
Limits​
  • You can create up to 20 triggers for each function. Triggers cannot be created during a canary release.​
  • Before deleting a function, you need to delete all TOS triggers first.​
  • After a TOS trigger is created, the bucket cannot be changed.​
  • If you need to deliver a TOS event to multiple functions, you need to go to the TOS console to perform the operation.​
  • If a TOS event notification is bound to multiple delivery targets, you can only view and delete it, but cannot edit it in the veFaaS console. To edit it, go to the TOS console.​
  • It will take about 30 seconds to deliver a TOS event notification to veFaaS.​
Procedure​
  1. Log in to the veFaaS console.​
  1. In the top navigation bar, select the target region.​
  1. In the function list, find the function for which you want to create a trigger and click its name.​
  1. On the function details page, click Create trigger on the Trigger tab.​
  1. In the Create trigger panel, specify the parameters as required.​
  • ​
    Parameter​
    Description​
    Trigger type​
    In this scenario, select TOS.​
    TOS Bucket​
    A TOS bucket is a space for storing objects. Select the TOS bucket that veFaaS needs to listen to. Fuzzy search is supported.​
    Trigger event​
    Select the events that veFaaS needs to listen to. You can select multiple events. For the supported TOS events and their meanings, see Event list.​
    warning​
    For scenarios in which file upload events are listened to, you need to select both tos:ObjectCreated:Put and tos:ObjectCreated:CompleteUpload if you are about to upload a large file in parts. Otherwise, you can just select tos:ObjectCreated:Put, which triggers the function after a simple object is uploaded.​
    Filter conditions​
    Filter conditions can confine the events that you need to listen for by accurately matching the specified objects, effectively reducing trigger frequency and cost.​
    • Prefix: Set the prefix information of objects to match as needed.​
    • Suffix: Set the suffix information of objects to match as needed.​
    • For example, if the trigger event is tos:Object:Created:*, the prefix is test/, and the suffix is .png, the function execution will be triggered when an object in png format is detected as being uploaded under the test directory.​
    tip​
    • The prefix and suffix are in an "AND" relationship, and the matching rule is exact matching.​
    • If neither prefix nor suffix is set, all objects in the bucket will be matched.​
    ​
warning​
You need to ensure semantic uniqueness for triggers created under one bucket. This means that the combination of trigger event, prefix, and suffix must be unique, and the matching scopes cannot overlap.​
For example, Trigger 1 has been created to listen for the tos:Object:Created:Put event on objects with the suffix png in Bucket-A. For Trigger 2, if the listened events include the tos:Object:Created:Put event from Trigger 1, the matched objects cannot overlap with those of Trigger 1, which means that objects with the suffix png must not be included. If included, Trigger 2 will fail to be created.​
  1. Click Confirm to create the TOS trigger.​
tip​
  • After the TOS trigger is created, an event push rule with the same name will be synchronously generated under the specified bucket in TOS. You can go to the TOS console to view it.​
  • After the TOS trigger is created, about 2 minutes are taken for it to take effect.​
What to do next​
  • For the method of modifying the configurations of the TOS trigger, see Managing triggers.​
​
Last updated: 2026.08.19 14:06:06