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

Updating the workflow console app example program to allow for CTRL+C to properly terminate the program, and Readme updates #1193

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b4f1e10
Initial setup for workflow log tracing
RyanLettieri Oct 21, 2023
017656e
Merge branch 'master' of https://github.com/dapr/dotnet-sdk into work…
RyanLettieri Oct 22, 2023
30962d7
Created log sink for E2E tests using serilog
RyanLettieri Nov 2, 2023
5649d74
Formatting
RyanLettieri Nov 2, 2023
7b3f381
Addressing feedback on review
RyanLettieri Nov 3, 2023
2f5f3f4
Addressing some review comments
RyanLettieri Nov 4, 2023
3917fb9
Addressing more feedbck in the workflow e2e test
RyanLettieri Nov 5, 2023
71064cf
Merge branch 'master' of https://github.com/dapr/dotnet-sdk into work…
RyanLettieri Nov 5, 2023
32ab503
Adding in ability to cancel workflow example
RyanLettieri Nov 28, 2023
1d02176
Updating workflow http command references to use beta api
RyanLettieri Nov 28, 2023
d92fd41
Updating workflow doc references to use beta api
RyanLettieri Nov 28, 2023
6100575
Merge branch 'master' into workflow-example-cancel
halspang Nov 29, 2023
b669585
Updates Dapr to 1.12 in GitHub actions itest (#1185)
JoshVanL Nov 29, 2023
1cb0052
Add holopin.yml config (#1147)
marcduiker Nov 29, 2023
f76b68c
Initial setup for workflow log tracing
RyanLettieri Oct 21, 2023
cef99e2
Created log sink for E2E tests using serilog
RyanLettieri Nov 2, 2023
e34dbc2
Addressing feedback on review
RyanLettieri Nov 3, 2023
5bddd62
Addressing some review comments
RyanLettieri Nov 4, 2023
329971f
Addressing more feedbck in the workflow e2e test
RyanLettieri Nov 5, 2023
28968b7
Adding in ability to cancel workflow example
RyanLettieri Nov 28, 2023
123ecbe
Updating workflow http command references to use beta api
RyanLettieri Nov 28, 2023
4180e59
Updating workflow doc references to use beta api
RyanLettieri Nov 28, 2023
0dd3e9b
Merge branch 'workflow-example-cancel' of https://github.com/RyanLett…
RyanLettieri Nov 29, 2023
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
6 changes: 6 additions & 0 deletions .github/holopin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
organization: dapr
defaultSticker: clmjkxscc122740fl0mkmb7egi
stickers:
-
id: clmjkxscc122740fl0mkmb7egi
alias: ghc2023
7 changes: 3 additions & 4 deletions .github/workflows/itests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ jobs:
GOOS: linux
GOARCH: amd64
GOPROXY: https://proxy.golang.org
DAPR_CLI_VER: 1.9.1
DAPR_RUNTIME_VER: 1.10.5
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/3dacfb672d55f1436c249057aaebbe597e1066f3/install/install.sh
DAPR_CLI_VER: 1.12.0
DAPR_RUNTIME_VER: 1.12.0
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.12/install/install.sh
DAPR_CLI_REF: ''
DAPR_REF: '4181de0edc65fc98a836ae7abc6042c575c8fae5'
steps:
- name: Set up Dapr CLI
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Run the following command to start a workflow.
{{% codetab %}}

```bash
curl -i -X POST http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=12345678 \
curl -i -X POST http://localhost:3500/v1.0-beta1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=12345678 \
-H "Content-Type: application/json" \
-d '{"Name": "Paperclips", "TotalCost": 99.95, "Quantity": 1}'
```
Expand All @@ -93,7 +93,7 @@ curl -i -X POST http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessing
{{% codetab %}}

```powershell
curl -i -X POST http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=12345678 `
curl -i -X POST http://localhost:3500/v1.0-beta1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=12345678 `
-H "Content-Type: application/json" `
-d '{"Name": "Paperclips", "TotalCost": 99.95, "Quantity": 1}'
```
Expand All @@ -111,7 +111,7 @@ If successful, you should see a response like the following:
Send an HTTP request to get the status of the workflow that was started:

```bash
curl -i -X GET http://localhost:3500/v1.0-alpha1/workflows/dapr/12345678
curl -i -X GET http://localhost:3500/v1.0-beta1/workflows/dapr/12345678
```

The workflow is designed to take several seconds to complete. If the workflow hasn't completed when you issue the HTTP request, you'll see the following JSON response (formatted for readability) with workflow status as `RUNNING`:
Expand Down
6 changes: 3 additions & 3 deletions examples/Workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ For the workflow API option, two identical `curl` commands are shown, one for Li
Make note of the "1234" in the commands below. This represents the unique identifier for the workflow run and can be replaced with any identifier of your choosing.

```bash
curl -i -X POST http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=1234 \
curl -i -X POST http://localhost:3500/v1.0-beta1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=1234 \
-H "Content-Type: application/json" \
-d '{"Name": "Paperclips", "TotalCost": 99.95, "Quantity": 1}'
```

On Windows (PowerShell):

```powershell
curl -i -X POST http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=1234 `
curl -i -X POST http://localhost:3500/v1.0-beta1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=1234 `
-H "Content-Type: application/json" `
-d '{"Name": "Paperclips", "TotalCost": 99.95, "Quantity": 1}'
```
Expand All @@ -83,7 +83,7 @@ If successful, you should see a response like the following:
Next, send an HTTP request to get the status of the workflow that was started:

```bash
curl -i -X GET http://localhost:3500/v1.0-alpha1/workflows/dapr/1234
curl -i -X GET http://localhost:3500/v1.0-beta1/workflows/dapr/1234
```

The workflow is designed to take several seconds to complete. If the workflow hasn't completed yet when you issue the previous command, you should see the following JSON response (formatted for readability):
Expand Down
11 changes: 9 additions & 2 deletions examples/Workflow/WorkflowConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@
// Start the input loop
using (daprClient)
{
while (true)
bool quit = false;
Console.CancelKeyPress += delegate
{
quit = true;
Console.WriteLine("Shutting down the example.");
};

while (!quit)
{
// Get the name of the item to order and make sure we have inventory
string items = string.Join(", ", baseInventory.Select(i => i.Name));
Expand Down Expand Up @@ -138,7 +145,7 @@ await daprClient.StartWorkflowAsync(
Console.WriteLine($"{state.WorkflowName} (ID = {orderId}) started successfully with {state.ReadInputAs<OrderPayload>()}");

// Wait for the workflow to complete
while (true)
while (!quit)
{
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
try
Expand Down
8 changes: 4 additions & 4 deletions examples/Workflow/WorkflowConsoleApp/demo.http
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
### Start order processing workflow - replace xxx with any id you like
POST http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=xxx
POST http://localhost:3500/v1.0-beta1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=xxx
Content-Type: application/json

{"Name": "Paperclips", "TotalCost": 99.95, "Quantity": 1}

### Start order processing workflow - replace xxx with any id you like
POST http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=xxx
POST http://localhost:3500/v1.0-beta1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=xxx
Content-Type: application/json

{"Name": "Cars", "TotalCost": 10000, "Quantity": 30}

### Query dapr sidecar - replace xxx with id from the workflow you've created above
GET http://localhost:3500/v1.0-alpha1/workflows/dapr/xxx
GET http://localhost:3500/v1.0-beta1/workflows/dapr/xxx

### Terminate the workflow - replace xxx with id from the workflow you've created above
POST http://localhost:3500/v1.0-alpha1/workflows/dapr/xxx/terminate
POST http://localhost:3500/v1.0-beta1/workflows/dapr/xxx/terminate
2 changes: 1 addition & 1 deletion test/Dapr.E2E.Test/Workflows/WorkflowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public async Task TestWorkflows()
}
catch (DaprException ex)
{
ex.InnerException.Message.Should().Contain("No such instance exists", $"Instance {instanceId} was not correctly purged");
ex.InnerException.Message.Should().Contain("no such instance exists", $"Instance {instanceId} was not correctly purged");
}

// Start another workflow for event raising purposes
Expand Down
Loading