Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow sample external interaction #1207

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions all.sln
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BulkPublishEventExample", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkflowUnitTest", "examples\Workflow\WorkflowUnitTest\WorkflowUnitTest.csproj", "{8CA09061-2BEF-4506-A763-07062D2BD6AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkflowExternalInteraction", "examples\Workflow\WorkflowExternalInteraction\WorkflowExternalInteraction.csproj", "{D85F8FA1-B2D6-444E-9FE1-59338C26094E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GeneratedActor", "GeneratedActor", "{7592AFA4-426B-42F3-AE82-957C86814482}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ActorClient", "examples\GeneratedActor\ActorClient\ActorClient.csproj", "{61C24126-F39D-4BEA-96DC-FC87BA730554}"
Expand Down Expand Up @@ -263,6 +265,10 @@ Global
{DDC41278-FB60-403A-B969-2AEBD7C2D83C}.Release|Any CPU.Build.0 = Release|Any CPU
{8CA09061-2BEF-4506-A763-07062D2BD6AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CA09061-2BEF-4506-A763-07062D2BD6AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D85F8FA1-B2D6-444E-9FE1-59338C26094E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D85F8FA1-B2D6-444E-9FE1-59338C26094E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D85F8FA1-B2D6-444E-9FE1-59338C26094E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D85F8FA1-B2D6-444E-9FE1-59338C26094E}.Release|Any CPU.Build.0 = Release|Any CPU
{61C24126-F39D-4BEA-96DC-FC87BA730554}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61C24126-F39D-4BEA-96DC-FC87BA730554}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61C24126-F39D-4BEA-96DC-FC87BA730554}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -348,6 +354,7 @@ Global
{4A175C27-EAFE-47E7-90F6-873B37863656} = {0EF6EA64-D7C3-420D-9890-EAE8D54A57E6}
{DDC41278-FB60-403A-B969-2AEBD7C2D83C} = {0EF6EA64-D7C3-420D-9890-EAE8D54A57E6}
{8CA09061-2BEF-4506-A763-07062D2BD6AC} = {BF3ED6BF-ADF3-4D25-8E89-02FB8D945CA9}
{D85F8FA1-B2D6-444E-9FE1-59338C26094E} = {BF3ED6BF-ADF3-4D25-8E89-02FB8D945CA9}
{7592AFA4-426B-42F3-AE82-957C86814482} = {D687DDC4-66C5-4667-9E3A-FD8B78ECAA78}
{61C24126-F39D-4BEA-96DC-FC87BA730554} = {7592AFA4-426B-42F3-AE82-957C86814482}
{CB903D21-4869-42EF-BDD6-5B1CFF674337} = {7592AFA4-426B-42F3-AE82-957C86814482}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Dapr.Workflow;

namespace WorkflowExternalInteraction.Activities
{
public class ApproveActivity : WorkflowActivity<string, bool>
{
public override async Task<bool> RunAsync(WorkflowActivityContext context, string input)
{
Console.WriteLine($"Workflow {input} is approved.");
Console.WriteLine("Running Approval activity ...");
await Task.Delay(TimeSpan.FromSeconds(5));
return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Dapr.Workflow;

namespace WorkflowExternalInteraction.Activities
{
public class RejectActivity : WorkflowActivity<string, bool>
{
public override async Task<bool> RunAsync(WorkflowActivityContext context, string input)
{
Console.WriteLine($"Workflow {input} is rejected.");
Console.WriteLine("Running Reject activity ...");
await Task.Delay(TimeSpan.FromSeconds(5));
return true;
}
}
}
85 changes: 85 additions & 0 deletions examples/Workflow/WorkflowExternalInteraction/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using Dapr.Client;
using Dapr.Workflow;
using WorkflowExternalInteraction.Activities;
using WorkflowExternalInteraction.Workflows;
using Microsoft.Extensions.Hosting;

const string DaprWorkflowComponent = "dapr";

// The workflow host is a background service that connects to the sidecar over gRPC
var builder = Host.CreateDefaultBuilder(args).ConfigureServices(services =>
{
services.AddDaprWorkflow(options =>
{
options.RegisterWorkflow<DemoWorkflow>();
options.RegisterActivity<ApproveActivity>();
options.RegisterActivity<RejectActivity>();
});
});

// Dapr uses a random port for gRPC by default. If we don't know what that port
// is (because this app was started separate from dapr), then assume 4001.
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DAPR_GRPC_PORT")))
{
Environment.SetEnvironmentVariable("DAPR_GRPC_PORT", "4001");
}

// Start the app - this is the point where we connect to the Dapr sidecar to
// listen for workflow work-items to execute.
using var host = builder.Build();
host.Start();


DaprClient daprClient = new DaprClientBuilder().Build();

while (!await daprClient.CheckHealthAsync())
{
Thread.Sleep(TimeSpan.FromSeconds(5));
}


using (daprClient)
{
Console.WriteLine($"Workflow Started.");
await daprClient.WaitForSidecarAsync();

string instanceId = $"demo-workflow-{Guid.NewGuid().ToString()[..8]}";

await daprClient.StartWorkflowAsync(

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 48 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (7.0)

'DaprClient' does not contain a definition for 'StartWorkflowAsync' and no accessible extension method 'StartWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)
workflowComponent: DaprWorkflowComponent,
workflowName: nameof(DemoWorkflow),
instanceId: instanceId,
input: instanceId);

bool enterPressed = false;
Console.WriteLine("Press [ENTER] in 10s to approve this workflow.");
Thread inputThread = new Thread(() =>
{
ConsoleKeyInfo keyInfo = Console.ReadKey();
if (keyInfo.Key == ConsoleKey.Enter)
{
Console.WriteLine("Approved.");
enterPressed = true;
}
});
inputThread.Start();
Thread.Sleep(10000);

if (enterPressed)
{
await daprClient.RaiseWorkflowEventAsync(instanceId, DaprWorkflowComponent, "Approval", true);

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (7.0)

'DaprClient' does not contain a definition for 'RaiseWorkflowEventAsync' and no accessible extension method 'RaiseWorkflowEventAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)
}
else
{
Console.WriteLine("Rejected.");
}

await daprClient.WaitForWorkflowCompletionAsync(

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 77 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (7.0)

'DaprClient' does not contain a definition for 'WaitForWorkflowCompletionAsync' and no accessible extension method 'WaitForWorkflowCompletionAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)
workflowComponent: DaprWorkflowComponent,
instanceId: instanceId);

GetWorkflowResponse state = await daprClient.GetWorkflowAsync(

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Build

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (8.0)

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (6.0)

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (7.0)

The type or namespace name 'GetWorkflowResponse' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 81 in examples/Workflow/WorkflowExternalInteraction/Program.cs

View workflow job for this annotation

GitHub Actions / run integration tests (7.0)

'DaprClient' does not contain a definition for 'GetWorkflowAsync' and no accessible extension method 'GetWorkflowAsync' accepting a first argument of type 'DaprClient' could be found (are you missing a using directive or an assembly reference?)
instanceId: instanceId,
workflowComponent: DaprWorkflowComponent);
Console.WriteLine($"Workflow state: {state.RuntimeStatus}");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\..\src\Dapr.Workflow\Dapr.Workflow.csproj" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>612,618</NoWarn>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Dapr.Workflow;
using WorkflowExternalInteraction.Activities;

namespace WorkflowExternalInteraction.Workflows
{
public class DemoWorkflow : Workflow<string, bool>
{
public override async Task<bool> RunAsync(WorkflowContext context, string input)
{
try
{
await context.WaitForExternalEventAsync<bool>(
eventName: "Approval",
timeout: TimeSpan.FromSeconds(15));
}
catch (TaskCanceledException)
{
Console.WriteLine("Approval timeout.");
await context.CallActivityAsync(nameof(RejectActivity), input);
Console.WriteLine("Reject Activity finished");
return false;
}


await context.CallActivityAsync(nameof(ApproveActivity), input);
Console.WriteLine("Approve Activity finished");

return true;
}
}
}
Loading