From 1c979a94d5fd368c3d855aa09cc210c3069267a4 Mon Sep 17 00:00:00 2001 From: Ryan Lettieri Date: Sun, 5 Feb 2023 16:15:52 -0700 Subject: [PATCH] Adding in description for managing workflows Signed-off-by: Ryan Lettieri --- .../workflow/howto-manage-workflow.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md b/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md index 57f94591a..69c49edb5 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md +++ b/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md @@ -16,7 +16,21 @@ Now that you've [set up the workflow and its activities in your application]({{< Manage your workflow within your code. In the `OrderProcessingWorkflow` example from the [Author a workflow]({{< ref "howto-author-workflow.md#write-the-workflow" >}}) guide, the workflow is registered in the code. You can then start, terminate, and get information about the workflow: ```csharp +string orderId = "exampleOrderId"; +string workflowComponent = "dapr"; +string workflowName = "OrderProcessingWorkflow"; +OrderPayload input = new OrderPayload("Paperclips", 99.95); +Dictionary 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); ``` {{% /codetab %}}