In this article we will explore how we can run a really simple workflow using Netflix Conductor.
Read more about Conductor here: https://github.com/Netflix/conductor
Visit our codebase and give us a star, it helps! :)
Conductor can orchestrate HTTP services out of the box without implementing any code. We will use that to create and run our first workflow.
To follow the steps in this article we will need to have Conductor running on your local. We can do that by following the steps here
1. Configuring our First Workflow
This is a sample workflow that we can leverage for our test.
{
"name": "first_sample_workflow",
"description": "First Sample Workflow",
"version": 1,
"tasks": [
{
"name": "get_population_data",
"taskReferenceName": "get_population_data",
"inputParameters": {
"http_request": {
"uri": "https://datausa.io/api/data?drilldowns=Nation&measures=Population",
"method": "GET"
}
},
"type": "HTTP"
}
],
"inputParameters": [],
"outputParameters": {
"data": "${get_population_data.output.response.body.data}",
"source": "${get_population_data.output.response.body.source}"
},
"schemaVersion": 2,
"restartable": true,
"workflowStatusListenerEnabled": false,
"ownerEmail": "example@email.com",
"timeoutPolicy": "ALERT_ONLY",
"timeoutSeconds": 0
}
This is an example workflow that queries a publicly available JSON API to retrieve some data. This workflow doesn’t require any worker implementation as the tasks in this workflow are managed by the system itself. This is an awesome feature of Conductor. For a lot of typical work, we won’t have to write any code at all.
To configure the workflow, head over to the swagger API of conductor server and access the metadata workflow create API:
If the link doesn’t open the right Swagger section, we can navigate to Metadata-Resource
→ POST /api/metadata/workflow
Paste the workflow payload into the Swagger API and hit Execute.
Now if we head over to the UI, we can see this workflow definition created:
http://localhost:5000/workflowDef/first_sample_workflow
2. Running our First Workflow
Let’s run this workflow. To do that we can use the swagger API under the workflow-resources
Let's specify our workflow name first_sample_workflow
and Hit Execute!
Conductor will return a workflow id.
You can find more options on how to run workflows here
Ok, we should see this running and get completed soon. Let’s go to the UI to see what happened.
To load the workflow directly, use this URL format:
http://localhost:5000/execution/<WORKFLOW_ID>
Replace <WORKFLOW_ID>
with our workflow id from the previous step. We should see a screen like below. Click on the different tabs to see all inputs and outputs and task list etc. Explore away!
Summary
In this blog post — we learned how to run a sample workflow in our Conductor installation. Concepts we touched on:
- Workflow creation
- System tasks such as HTTP
- Running a workflow via API
Thank you for reading, and we hope you found this helpful. Please feel free to reach out to us for any questions and we
are happy to help in any way we can.
Who are we?
We are founding engineers of Netflix Conductor who has got together to form Orkes Inc. - a company focused on helping developers to adopt and use Netflix Conductor for building distributed systems at scale and with reliability.
Join our slack channel to reach us and talk about your use-cases. We would love to talk to you!
Top comments (0)