Skip to content

Commit

Permalink
Merge pull request #499 from RizaFarheen/main
Browse files Browse the repository at this point in the history
Update http.md
  • Loading branch information
nhandt2021 authored Jul 25, 2023
2 parents 15eb468 + 8045493 commit 582d9f2
Showing 1 changed file with 68 additions and 1 deletion.
69 changes: 68 additions & 1 deletion docs/reference-docs/system-tasks/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ HTTP task allows you to make calls to remote services exposed over HTTP/HTTPS.
| contentType | Provide the content type for the server. The supported types are **text/plain**, **text/html**, and **application/json**. By default, it is set to **application/json**. |
| headers | A map of additional http headers to be sent along with the request. |
| body | Request body when using **POST** or **PUT**. |
| asyncComplete | If set, the task remains in the **IN_PROGRESS** state even after the execution. An external event (Task Update API or Event handler) is expected to mark the task as completed.
| asyncComplete | If set, the task remains in the **SCHEDULED** state even after the execution. An external event (Task Update API or Event handler) is expected to mark the task as completed.
| connectionTimeOut | Set the connection timeout in milliseconds. If set to 0, it is equivalent to infinity. By default, the value is set to 100. |
| readTimeOut | Set the read timeout in milliseconds. If set to 0, it is equivalent to infinity. By default, the value is set to 150. |

Expand Down Expand Up @@ -151,3 +151,70 @@ HTTP task allows you to make calls to remote services exposed over HTTP/HTTPS.
</p>
</details>

<details><summary>Using Async Complete</summary>
<p>
While defining workflow definitions, we have a parameter, “asyncComplete”. Setting this parameter to “true” ensures that the task can be completed asynchronously only.

Let’s have a look at an example workflow with “asynComplete:true”,

```json
{
"name": "async_complete_example",
"description": "Edit or extend this sample workflow. Set the workflow name to get started",
"version": 1,
"tasks": [
{
"name": "http_task_85tf2",
"taskReferenceName": "http_task_85tf2_ref",
"inputParameters": {
"http_request": {
"uri": "https://orkes-api-tester.orkesconductor.com/api",
"method": "GET",
"connectionTimeOut": 3000,
"readTimeOut": "3000",
"accept": "application/json",
"contentType": "application/json"
}
},
"type": "HTTP",
"asyncComplete": true
}
],
"schemaVersion": 2,
"ownerEmail": "riza.farheen@orkes.io"
}
```

Now, let’s run this in the Playground.

[Run in Orkes Playground](https://play.orkes.io/runWorkflow)

1. Under **Workflow Name**, choose **async_complete_example**.
2. Click **Run Workflow**.

On running this workflow, the HTTP task wouldn’t get completed; instead, it would be in a “Scheduled” state, i.e., the workflow is paused.

There are multiple ways to update the task status to complete.

#### Using API

Once the workflow is run, the workflowId will be generated. You can view the workflowId below the workflow name on the execution page.

<p align="center"><img src="/content/img/workflowid.png" alt="Workflow ID in Conductor" width="100%" height="auto"></img></p>

By using the **workflowId** and the **taskRefName**, you can use the following API to complete the task.

```
POST /api/tasks/{workflowId}/{taskRefName}/{status}
```
Another method to update the task status is directly from the UI.

#### From Conductor UI

From the workflow execution page, click on the task and then update the status manually to “COMPLETED”.

<p align="center"><img src="/content/img/workflow-status-update-from-ui.png" alt="Updating workflow status from Conductor UI" width="100%" height="auto"></img></p>

So, using the above methods, you can asynchronously complete your workflow. This can be useful when you need to pause the workflow for external interventions.
</p>
</details>

0 comments on commit 582d9f2

Please sign in to comment.