Setting Asynchronous Invocation Configuration for a Function Version
Function
This API is used to set asynchronous invocation configuration for a function version.
URI
PUT /v2/{project_id}/fgs/functions/{function_urn}/async-invoke-config
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Tenant's project ID. Minimum: 1 Maximum: 32 |
| function_urn | Yes | String | Function URN. Minimum: 1 Maximum: 269 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| max_async_event_age_in_seconds | No | Integer | Maximum validity period of a message. Value range: 1s to 86,400s. Default value: 3600s. Minimum: 1 Maximum: 86400 |
| max_async_retry_attempts | No | Integer | Maximum number of retry attempts to be made if an asynchronous invocation failure occurs. Default value: 1. Value range: 0–3. Minimum: 0 Maximum: 3 |
| destination_config | No | FuncAsyncDestinationConfig object | Asynchronous invocation target. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| on_success | No | FuncDestinationConfig object | Target to be invoked when a function is successfully executed. |
| on_failure | No | FuncDestinationConfig object | Target to be invoked when a function fails to be executed due to a system error or an internal error. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| destination | No | String | Target service type.
Enumeration values:
|
| param | No | String | Parameters (in JSON format) corresponding to the target service.
|
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| func_urn | String | Function URN. Minimum: 1 Maximum: 269 |
| max_async_event_age_in_seconds | Integer | Maximum validity period of a message. Value range: 60s to 86,400s. |
| max_async_retry_attempts | Integer | Maximum number of retry attempts to be made if an asynchronous invocation failure occurs. Default value: 3. Value range: 0–8. |
| destination_config | FuncAsyncDestinationConfig object | Asynchronous invocation target. |
| created_time | String | Time when the asynchronous invocation configuration was created. |
| last_modified | String | Time when the asynchronous invocation configuration was modified. |
| Parameter | Type | Description |
|---|---|---|
| on_success | FuncDestinationConfig object | Target to be invoked when a function is successfully executed. |
| on_failure | FuncDestinationConfig object | Target to be invoked when a function fails to be executed due to a system error or an internal error. |
| Parameter | Type | Description |
|---|---|---|
| destination | String | Target service type.
Enumeration values:
|
| param | String | Parameters (in JSON format) corresponding to the target service.
|
Example Requests
Set asynchronous invocation configuration for a function version.
PUT https://{functiongraph_endpoint}/v2/{project_id}/fgs/functions/{function_urn}/async-invoke-config
{
"max_async_event_age_in_seconds" : 60,
"max_async_retry_attempts" : 1,
"destination_config" : {
"on_success" : {
"destination" : "FunctionGraph",
"param" : "{\"func_urn\":\"urn:fss:cn-north-7:5691ba790e2b46ceb38316xxxxxxxxxx:function:default:testPython:latest\"}"
},
"on_failure" : {
"destination" : "FunctionGraph",
"param" : "{\"func_urn\":\"urn:fss:cn-north-7:5691ba790e2b46ceb38316xxxxxxxxxx:function:default:testPython:latest\"}"
}
}
} Example Responses
Status code: 200
Ok
{
"func_urn" : "urn:fss:xxxxxxxxx:7aad83af3e8d42e99ac194xxxxxxxxxx:function:default:test:latest",
"max_async_event_age_in_seconds" : 60,
"max_async_retry_attempts" : 1,
"destination_config" : {
"on_success" : {
"destination" : "FunctionGraph",
"param" : "{\"func_urn\":\"urn:fss:cn-north-7:5691ba790e2b46ceb38316xxxxxxxxxx:function:default:testPython:latest\"}"
},
"on_failure" : {
"destination" : "FunctionGraph",
"param" : "{\"func_urn\":\"urn:fss:cn-north-7:5691ba790e2b46ceb38316xxxxxxxxxx:function:default:testPython:latest\"}"
}
},
"created_time" : "2021-03-04T14:50:02+08:00",
"last_modified" : "2021-03-04T14:50:02+08:00"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Ok |
| 400 | Bad Request |
| 404 | Not Found |
Error Codes
See Error Codes.
Last Article: Setting the Number of RIs
Next Article: Obtaining the Asynchronous Invocation Configuration of a Function Version
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.