You can call this operation to create or update a specified asynchronous invocation configuration of a function in a service.

  • If the function does not have the asynchronous invocation configuration, you can call the PutFunctionAsyncInvokeConfig operation to create the configuration.
  • If the function has the asynchronous invocation configuration, you can call the PutFunctionAsyncInvokeConfig operation to update the configuration with the configuration items that are specified in the request. Items that are not specified in the request remain unchanged.

Request headers

This operation uses only common request headers. For more information, see Common parameters.

Request syntax

PUT /services/{serviceName[.qualifier]}/functions/{functionName}/async-invoke-config 

Request parameters

Parameter Type Position Required Example Description
serviceName String Path Yes service_name

The name of the service that contains the function for which you want to create or update the asynchronous invocation configuration.

functionName String Path Yes testHelloWorld

The name of the function.

qualifier String Path No alias

The alias or version of the service.

Object Body No

The asynchronous invocation configurations.

destinationConfig DestinationConfig Body No

The configuration structure of the destination for asynchronous invocation.

maxAsyncEventAgeInSeconds Long Body No 300

The validity period of requests. Valid values: 1 to 2592000. Unit: seconds.

maxAsyncRetryAttempts Long Body No 3

The maximum number of retries after an asynchronous invocation fails. Default value: 3. Valid values: 0 to 8.

Response parameters

Parameter Type Example Description
createdTime String 2020-08-20T02:28:21Z

The time when the service was created.

destinationConfig DestinationConfig

The configuration structure of the destination for asynchronous invocation.

functionName String testHelloWorld

The name of the function.

lastModifiedTime String 2020-09-10T02:45:02Z

The time when the asynchronous invocation configuration was last updated.

maxAsyncEventAgeInSeconds Long 1

The validity period of requests. Valid values: 1 to 2592000. Unit: seconds.

maxAsyncRetryAttempts Long 1

The maximum number of retries after an asynchronous invocation fails. Default value: 3. Valid values: 0 to 8.

qualifier String alias

The alias or version of the service.

serviceName String service_name

The name of the service that contains the function for which you want to create or update the asynchronous invocation configuration.

Examples

Sample requests

PUT /2016-08-15/services/service_name.alias/functions/testHelloWorld/async-invoke-config HTTP/1.1
Common request headers
{
    "destinationConfig":{
        "onSuccess":{
            "destination":"acs:mns:cn-shanghai:1986***743:/queues/queue_name/messages"
        },
        "onFailure":{
            "destination":"acs:fc:cn-hangzhou:1986***743:services/demo3.alias/functions/testHelloWorld"
        }
    },
    "maxAsyncEventAgeInSeconds":1,
    "maxAsyncRetryAttempts":1
}

Sample success responses

JSON format

HTTP/1.1 200 OK
Common response headers
{
    "serviceName":"service_name",
    "functionName":"testHelloWorld",
    "createdTime":"2020-08-20T02:28:21Z",
    "qualifier":"alias",
    "lastModifiedTime":"2020-09-10T02:45:02Z",
    "destinationConfig":{
        "onSuccess":{
            "destination":"acs:mns:cn-shanghai:1986***743:/queues/queue_name/messages"
        },
        "onFailure":{
            "destination":"acs:fc:cn-hangzhou:1986***743:services/service_name.alias/functions/testHelloWorld"
        }
    },
    "maxAsyncEventAgeInSeconds":1,
    "maxAsyncRetryAttempts":1
}