Triggering a Function
FunctionGraph applications are composed of functions and event sources. Event sources are cloud services or user-defined applications that publish events, and functions are custom code for processing events.
FunctionGraph functions can be triggered by multiple cloud services. For details, see Supported Event Sources. After you configure event sources to trigger your functions, FunctionGraph automatically invokes the functions when events occur.
FunctionGraph supports the following two function invocation modes:
- Synchronous invocation
Clients wait for explicit responses to their requests from a function. Responses are returned only after the function is invoked.
- Asynchronous invocation
Clients do not care about the function invocation results of their requests. After receiving a request, FunctionGraph puts it in a queue, returns a response, and processes requests when there are idle resources.
If a function is invoked asynchronously and is throttled, FunctionGraph automatically retries the throttled event, with an interval between retries. Asynchronous events are queued before they are used to invoke a function.
Table 1 lists the function invocation modes for supported event sources.
Event Source | Invocation Mode |
---|---|
SMN | Asynchronous invocation |
APIG | Synchronous invocation |
OBS | Asynchronous invocation |
DIS | Asynchronous invocation |
Timer | Asynchronous invocation |
LTS | Asynchronous invocation |
Cloud Trace Service (CTS) | Asynchronous invocation |
DMS for Kafka | Asynchronous invocation |