From 1cde7896c3042bcf0644a92726b8248e4c233e4b Mon Sep 17 00:00:00 2001 From: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Date: Wed, 8 Feb 2023 15:38:45 -0600 Subject: [PATCH] [docs] Add workflows to .NET client doc (#1019) * add workflows to client page Signed-off-by: Hannah Hunter --- .../dotnet-sdk-docs/dotnet-client/_index.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md b/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md index 64bf1c787..0404857e8 100644 --- a/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md +++ b/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md @@ -199,12 +199,33 @@ await foreach (var items in subscribeConfigurationResponse.Source.WithCancellati } ``` +### Manage workflow instances (Alpha) + +```csharp +var daprClient = new DaprClientBuilder().Build(); + +string instanceId = "MyWorkflowInstance1"; +string workflowComponentName = "dapr"; // alternatively, this could be the name of a workflow component defined in yaml +string workflowName = "MyWorkflowDefinition"; +var input = new { name = "Billy", age = 30 }; // Any JSON-serializable value is OK + +// Start workflow +var startResponse = await daprClient.StartWorkflowAsync(instanceId, workflowComponentName, workflowName, input); + +// Terminate workflow +await daprClient.TerminateWorkflowAsync(instanceId, workflowComponentName); + +// Get workflow metadata +var getResponse = await daprClient.GetWorkflowAsync(instanceId, workflowComponentName, workflowName); +``` + ## Sidecar APIs ### Sidecar Health The .NET SDK provides a way to poll for the sidecar health, as well as a convenience method to wait for the sidecar to be ready. #### Poll for health This health endpoint returns true when both the sidecar and your application are up (fully initialized). + ```csharp var client = new DaprClientBuilder().Build();