From 6828dd28baf96f89e58be464dd4971bd20b46646 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Tue, 16 May 2023 12:24:39 -0400 Subject: [PATCH] update code snippet for dotnet Signed-off-by: Hannah Hunter --- .../quickstarts/workflow-quickstart.md | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/daprdocs/content/en/getting-started/quickstarts/workflow-quickstart.md b/daprdocs/content/en/getting-started/quickstarts/workflow-quickstart.md index f25808520..b29df047b 100644 --- a/daprdocs/content/en/getting-started/quickstarts/workflow-quickstart.md +++ b/daprdocs/content/en/getting-started/quickstarts/workflow-quickstart.md @@ -151,25 +151,29 @@ string orderId = Guid.NewGuid().ToString()[..8]; string itemToPurchase = "Cars"; int ammountToPurchase = 10; -//... +// Construct the order +OrderPayload orderInfo = new OrderPayload(itemToPurchase, 15000, ammountToPurchase); // Start the workflow Console.WriteLine("Starting workflow {0} purchasing {1} {2}", orderId, ammountToPurchase, itemToPurchase); -await workflowClient.ScheduleNewWorkflowAsync( - name: nameof(OrderProcessingWorkflow), +await daprClient.StartWorkflowAsync( + workflowComponent: DaprWorkflowComponent, + workflowName: nameof(OrderProcessingWorkflow), + input: orderInfo, + instanceId: orderId); + +// Wait for the workflow to start and confirm the input +GetWorkflowResponse state = await daprClient.WaitForWorkflowStartAsync( instanceId: orderId, - input: orderInfo); + workflowComponent: DaprWorkflowComponent); -//... +Console.WriteLine("Your workflow has started. Here is the status of the workflow: {0}", state.RuntimeStatus); -WorkflowState state = await workflowClient.GetWorkflowStateAsync( +// Wait for the workflow to complete +state = await daprClient.WaitForWorkflowCompletionAsync( instanceId: orderId, - getInputsAndOutputs: true); - -Console.WriteLine("Your workflow has started. Here is the status of the workflow: {0}", state); - -//... + workflowComponent: DaprWorkflowComponent); Console.WriteLine("Workflow Status: {0}", state.RuntimeStatus); ```