Suspend task
The Suspendtask lets you temporarily pause and then resume the execution of an integration.
During an integration execution, when the control reaches a Suspend task, execution is halted, and all tasks after the Suspend task are suspended. Integration resumes the execution when any of the following events occur:
- Expiry of the specified suspension time.
- After receiving a resume execution request from the SuspensionsAPI.
You can also configure an output variable ( Suspension result ) for the Suspend task and set it to any value and use the value to create branching conditions for executing the downstream tasks.
Compare Approval task, Suspend task, and Timer task
All the three ( Approval , Suspend , and Timer ) tasks perform a similar function of pausing and resuming an integration. However, there are subtle differences among them. The following table describes the differences amongst the three tasks.
| Approval task | Suspend task | Timer task | 
|---|---|---|
|   
Doesn't support automatic resumption of an integration and requires
      manual intervention to resume the integration. | Supports both manual and automatic resumption of an integration. If there is no manual intervention to revoke the suspension, the integration will automatically resume execution after the expiry of the suspension time limit. | Supports only automatic resumption of an integration. The integration execution automatically resumes after the exipry of the suspension time limit. | 
|   
Can't resume an integration via an API call. You must manually resolve the
      suspension by using the Integrations UI. | Can resume an integration by using the SuspensionsAPI for integrations. | Supports only automatic resumption of an integration. | 
|   
Users receive notification when an integration pauses (suspended). | Users don't receive any notification when an integration pauses (suspended). | Users don't receive any notification when an integration pauses (suspended). | 
|   
Supports a output variable (boolean), which allows you to perform conditional checks
    before resuming an integration. However, the output variable can only have
      the value as either  trueorfalse. | Supports a output variable (string), which allows you to perform conditional checks before resuming an integration. You can set any value to the output variable. | Doesn't support any output variables. | 
Configure the Suspend task
To configure the Suspendtask, perform the following steps:
- In the Google Cloud console, go to the Application Integration page.
- In the navigation menu, click Integrations 
. The Integrations page appears listing all the integrations available in the Google Cloud project. 
- Select an existing integration or click Create integration 
to create a new one. If you are creating a new integration: - Enter a name and description in the Create Integration pane.
- Select a region for the integration.
- Select a service account for the integration. You can change or update the service account details of an integration any time from the Integration summary pane in the integration toolbar.
- Click Create . The newly created integration opens in the integration editor .
 
- In the integration editor navigation bar, click Tasks to view the list of available tasks and connectors.
- Click and place the Suspendtask element in the integration editor.
- Click the Suspendtask element on the designer to view the Suspendtask configuration pane.
- Configure the remaining fields using the Configuration properties 
for the task
as detailed in the tables below. All changes to the properties are saved automatically. 
Configuration properties
The following table describes the configuration properties of the Suspend task.
| Property | Data type | Description | 
|  Suspension Time | Integer | Time (in minutes) till which the integration execution must be suspended. The maximum
     time limit is 44640 
minutes (31 days) which is also the default value. If the integration execution doesn't resume within the specified time limit,
     integration automatically resumes the execution after the expiry of the time limit and
     sets the value of the  | 
|  Suspension result | String | A variable to store the result of the Suspend task. Setting the value to this variable is optional. You can set this variable to any value based on your requirement. This variable is helpful if you want to have more control over your integration's execution flow. For example, you can read the suspension result and configure conditional decisions based on the value in any of your downstream tasks. | 
|  Suspension Id | String | A unique identifier for the Suspend task. The value of this
    variable is set immediately after the integration is suspended. You can get the
     identifier value from the execution logs 
page in the integration UI. You can also get the get the identifier value from the response object of an API if you are using an API to trigger
    the integration. You can resume the integration execution either by using the suspension ID or by using the integration's execution ID. | 
Revoke a suspension with the Suspensions API
The Suspensions API lets you revoke a suspension via a API call. To revoke a suspension with
  the Suspensions 
API, you must have either the execution ID of the integration or
  the suspension ID of the Suspend task. To revoke a suspension, you
  must issue a POST 
request to the following API:
https:// REGION -integrations.googleapis.com/v1/{name=projects/ PROJECT /locations/ LOCATION /integrations/ INTEGRATION_ID /executions/ EXECUTION_ID /suspensions/ SUSPENSION_ID }:lift
In this API, the  INTEGRATION_ID 
 
is optional. However, you must provide
either the  EXECUTION_ID 
 
or the  SUSPENSION_ID 
 
. If you don't have any of
  the ID values, you can substitute the value with - 
. In this API,  REGION 
 
,  PROJECT 
 
, and  LOCATION 
 
are required fields.
After you revoke the suspension, integration execution resumes and executes the downstream tasks after the Suspend task.
The following examples show how to revoke a suspension by using the suspensions API.
Example 1: Revoke a suspension with only the suspension ID
The following curl 
command shows you how to revoke a suspension when you only have the suspension ID:
curl -H "Authorization: Bearer $TOKEN" \
  -H "Content-type: application/json" \
  -H X-GFE-SSL: yes \
  -X POST \
  -d '{"suspension_result":"Approved"}' \
  https://us-east1-integrations.googleapis.com/v1/projects/demo-project/locations/us-east1/integrations/-/executions/-/suspensions/c6a13a79-a918-41e2-82b9-32b5a010755a:lift 
In this example, the Suspension result 
variable is set to Approved 
for the supension ID c6a13a79-a918-41e2-82b9-32b5a010755a 
.
Example 2: Revoke a suspension with only the execution ID
The following curl 
command shows you how to revoke a suspension when you only have the execution ID:
curl -H "Authorization: Bearer $TOKEN" \
  -H "Content-type: application/json" \
  -H X-GFE-SSL: yes \
  -X POST \
  -d '{"suspension_result":"true"}' \
  https://us-east1-integrations.googleapis.com/v1/projects/demo-project/locations/us-east1/integrations/-/executions/76a391e7-c801-45d7-8046-eab20d167ec5/suspensions/-:lift 
In this example, the Suspension result 
variable is set to true 
for the execution ID 76a391e7-c801-45d7-8046-eab20d167ec5 
.
Example 3: Revoke a suspension with both the execution ID and the suspension ID
The following curl 
command shows you how to revoke a suspension when you have both the execution ID and the suspension ID:
curl -H "Authorization: Bearer $TOKEN" \
  -H "Content-type: application/json" \
  -H X-GFE-SSL: yes \
  -X POST \
  -d '{"suspension_result":"{processname: "Release", owner: "John", status: "approved"};"}' \
  https://us-east1-integrations.googleapis.com/v1/projects/demo-project/locations/us-east1/integrations/-/executions/9b721baa-0a23-4576-b2b6-d251d163ea6f/suspensions/f01815bf-ed18-4e01-9d41-cc2ce7861e95:lift 
In this example, the Suspension result 
variable is set to {processname: "Release", owner: "John", status: "approved"}; 
for the suspension ID f01815bf-ed18-4e01-9d41-cc2ce7861e95 
.
Error handling strategy
An error handling strategy for a task specifies the action to take if the task fails due to a temporary error . For information about how to use an error handling strategy, and to know about the different types of error handling strategies, see Error handling strategies .
Quotas and limits
For information about quotas and limits, see Quotas and limits .
What's next
- Learn about all tasks and triggers .
- Learn how to test and publish an integration .
- Learn about error handling .
- Learn about integration execution logs .

