{{ $t('productDocDetail.guideClickSwitch') }}
{{ $t('productDocDetail.know') }}
{{ $t('productDocDetail.dontRemind') }}
6.11.3
{{sendMatomoQuery("Sangfor Cloud Platform (SCP)","Asynchronous Task Mechanism")}}

Asynchronous Task Mechanism

{{ $t('productDocDetail.updateTime') }}: 2026-04-29

Time-consuming operations are performed via asynchronous tasks on SCP. Asynchronous tasks consist of the following concepts:

  1. Asynchronous task API: Used to perform a time-consuming operation in an asynchronous manner.
  2. Task: The entity created on SCP to execute specific business logic after the asynchronous task API is called.
  3. Task API: Used to query the task progress, cancel a task, or perform other operations on a task.

Below is the sample procedure for creating a VM:

  1. Call the VM creation API to initiate the asynchronous task, and then SCP immediately returns 3 elements of the asynchronous task:
    1. Resource ID, that is, the ID of the VM to be created. Note that the resource ID is available only after the task is complete.
    2. Task ID, which is used to query or cancel the asynchronous task.
    3. (Optional) Error message, which is returned when the API call fails.
  2. The client regularly queries whether the asynchronous task is complete based on the task ID. For more information, see the Query Task Details section (API: /janus/20180725/tasks/{task_id}) in SCP Open API documentation.
  3. The asynchronous task is complete. You can use the resource ID to query resource details.

The sequence diagram is shown in Figure 15.

Figure 15 Asynchronous Task Execution Process