How to: Manage workflows
Now that you’ve authored the workflow and its activities in your application, you can start, terminate, and get information about the workflow using HTTP API calls. For more information, read the workflow API reference.
Manage your workflow within your code. In the
OrderProcessingWorkflow example from the Author a workflow guide, the workflow is registered in the code. You can now start, terminate, and get information about a running workflow:
string orderId = "exampleOrderId"; string workflowComponent = "dapr"; string workflowName = "OrderProcessingWorkflow"; OrderPayload input = new OrderPayload("Paperclips", 99.95); Dictionary<string, string> workflowOptions; // This is an optional parameter CancellationToken cts = CancellationToken.None; // Start the workflow. This returns back a "WorkflowReference" which contains the instanceID for the particular workflow instance. WorkflowReference startResponse = await daprClient.StartWorkflowAsync(orderId, workflowComponent, workflowName, input, workflowOptions, cts); // Get information on the workflow. This response will contain information such as the status of the workflow, when it started, and more! GetWorkflowResponse getResponse = await daprClient.GetWorkflowAsync(orderId, workflowComponent, workflowName); // Terminate the workflow await daprClient.TerminateWorkflowAsync(instanceId, workflowComponent);
Manage your workflow using HTTP calls. The example below plugs in the properties from the Author a workflow example with a random instance ID number.
To start your workflow with an ID
To terminate your workflow with an ID
Get information about a workflow
To fetch workflow information (outputs and inputs) with an ID
Learn more about these HTTP calls in the workflow API reference guide.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.