Updated on 2024-11-12 GMT+08:00

Asynchronous Invocation

When a client triggers a function, FunctionGraph persists the request and sends a response immediately to the client. The client proceeds without waiting for the execution result. You cannot know the result in real time. FunctionGraph queues the asynchronous requests and processes them when the server is idle. To obtain asynchronous processing results or to retry when an asynchronous request fails, configure asynchronous settings.

  • The following triggers are invoked asynchronously by default and the invocation mode cannot be changed.
    Table 1 Invocation mode

    Event Source

    Invocation Mode

    SMN

    Asynchronous

    OBS

    Asynchronous

    DIS

    Asynchronous

    Timer

    Asynchronous

    LTS

    Asynchronous

    DDS

    Asynchronous

    DMS for Kafka

    Asynchronous

    DMS for RabbitMQ

    Asynchronous

    GeminiDB Mongo

    Asynchronous

  • APIG, APIG (dedicated), and APIC triggers can be configured for asynchronous invocation on their console. You can also use the asynchronous execution API instead. In this scenario, the maximum execution duration of a function is 12 hours (configured in the whitelist).

    If the E2E function execution latency exceeds 90s, asynchronous invocation is recommended. If synchronous invocation is used, no responses can be received after 90s due to gateway restrictions.

Example

The following procedure uses the APIG trigger of a function as an example.

  1. Go to the function details page, and choose Configuration > Triggers.
  2. Click the APIG trigger name to go to the APIG console.
    Figure 1 Clicking a trigger name
  3. Click Edit in the upper right.
    Figure 2 Clicking Edit
  4. Click Next until the Define Backend Request page is displayed. Then change Invocation Mode to Asynchronous.
    Figure 3 Changing the invocation mode
  5. Click Finish to save the settings.