From f07700ec195e52a352ec96d6f90d8618bb873ff0 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 18 Mar 2025 11:04:09 -0500 Subject: [PATCH 1/2] Updated .NET workflow method names Signed-off-by: Whit Waldo --- .../workflow/howto-manage-workflow.md | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) 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 f03f4a4c471..91571c3265b 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 @@ -137,31 +137,29 @@ Manage your workflow within your code. In the `OrderProcessingWorkflow` example ```csharp string orderId = "exampleOrderId"; -string workflowComponent = "dapr"; -string workflowName = "OrderProcessingWorkflow"; OrderPayload input = new OrderPayload("Paperclips", 99.95); Dictionary workflowOptions; // This is an optional parameter -// Start the workflow. This returns back a "StartWorkflowResponse" which contains the instance ID for the particular workflow instance. -StartWorkflowResponse startResponse = await daprClient.StartWorkflowAsync(orderId, workflowComponent, workflowName, input, workflowOptions); +// Start the workflow using the orderId as our workflow ID. This returns a string containing the instance ID for the particular workflow instance, whether we provide it ourselves or not. +await daprWorkflowClient.ScheduleNewWorkflowAsync(nameof(OrderProcessingWorkflow), orderId, input, workflowOptions); // Get information on the workflow. This response contains information such as the status of the workflow, when it started, and more! -GetWorkflowResponse getResponse = await daprClient.GetWorkflowAsync(orderId, workflowComponent, eventName); +WorkflowState currentState = await daprWorkflowClient.GetWorkflowStateAsync(orderId, orderId); // Terminate the workflow -await daprClient.TerminateWorkflowAsync(orderId, workflowComponent); +await daprWorkflowClient.TerminateWorkflowAsync(orderId); -// Raise an event (an incoming purchase order) that your workflow will wait for. This returns the item waiting to be purchased. -await daprClient.RaiseWorkflowEventAsync(orderId, workflowComponent, workflowName, input); +// Raise an event (an incoming purchase order) that your workflow will wait for +await daprWorkflowClient.RaiseEventAsync(orderId, "incoming-purchase-order", input); // Pause -await daprClient.PauseWorkflowAsync(orderId, workflowComponent); +await daprWorkflowClient.SuspendWorkflowAsync(orderId); // Resume -await daprClient.ResumeWorkflowAsync(orderId, workflowComponent); +await daprWorkflowClient.ResumeWorkflowAsync(orderId); // Purge the workflow, removing all inbox and history information from associated instance -await daprClient.PurgeWorkflowAsync(orderId, workflowComponent); +await daprWorkflowClient.PurgeWorkflowAsync(orderId); ``` {{% /codetab %}} From 21dfdbbb28efe3a6de5076ffe0a23cce6fa6d438 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Wed, 9 Apr 2025 15:17:19 -0500 Subject: [PATCH 2/2] Fixed incorrect .NET method name for purging workflow instances Signed-off-by: Whit Waldo --- .../building-blocks/workflow/howto-manage-workflow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c12134b0324..b29667a0e89 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 @@ -160,7 +160,7 @@ await daprWorkflowClient.SuspendWorkflowAsync(orderId); await daprWorkflowClient.ResumeWorkflowAsync(orderId); // Purge the workflow, removing all inbox and history information from associated instance -await daprWorkflowClient.PurgeWorkflowAsync(orderId); +await daprWorkflowClient.PurgeInstanceAsync(orderId); ``` {{% /codetab %}}