What is a Trigger?
A trigger acts as a bridge between events and your serverless functions. It provides a centralized way to manage event sources and automatically triggers function execution based on predefined rules. When a specific event occurs and meets the conditions defined by the trigger, the associated function is automatically executed. This enables an efficient event-driven architecture, allowing your functions to respond to various events without manual intervention.
Navigating to the Trigger Configuration Page
Before configuring a trigger, ensure you have created and configured an active CDN acceleration domain on the CDNetworks platform and have deployed your function.
There are two ways to access the trigger configuration page:
- Initial Access from Function Creation: After writing and testing your code in CloudIDE and completing the online grayscale deployment of your function, click Configure Triggers.
- Accessing from the Menu Bar: Under the Edge Cloud Apps menu, click Trigger Management to access the Function Trigger details page. Click Add to create a new CDN trigger configuration.
Setting Up a Trigger
- On the trigger configuration page, select the domain you want to associate with the function and choose the function you have already created and deployed. A single domain can be associated with multiple functions, including custom functions you have written and pre-configured public functions provided by the CDNetworks platform.
Note:
The order in which functions are associated determines their priority of execution. Carefully plan the execution order to ensure your business logic operates as intended.
- Carefully review your configuration, ensuring you have selected the correct domain and function.
- Click Confirm to create the trigger. Trigger configurations usually take effect immediately, and your function will begin responding to events that match the trigger rules.
Notes
- Trigger Scope: Triggers only take effect on the associated domain. For example, if you configure a trigger to take effect on the
www.example.com
domain, only requests accessing www.example.com
will trigger function execution.
- Domain Uniqueness: Each domain can be associated with only one trigger configuration. Once a trigger is created, its associated domain cannot be modified. When creating a new trigger, you cannot select a domain that is already associated with another trigger.
- Trigger Limit: A single trigger configuration can be associated with a maximum of 10 functions. If you need to associate more functions, please contact the CDNetworks technical support team.