quickstarts/workflows/csharp/sdk
Paul Yuknewicz c7f5100b0a
Merging `release-1.12` into main branch (#952)
* update dapr runtime to use v1.12.0-rc.1

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

* update to latest rc for runtime and cli

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

* try sleeping

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

* pin redis version

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

* rm sleep

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

* rm deprecated unsubscribe call

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

* Update configuration/go/sdk/order-processor/app.go

Co-authored-by: Josh van Leeuwen <me@joshvanl.dev>
Signed-off-by: Cassie Coyle <cassie.i.coyle@gmail.com>

* Statemanagement multiapp run

Signed-off-by: rabollin <rabollin@microsoft.com>

* message sequence

Signed-off-by: rabollin <rabollin@microsoft.com>

* message sequence

Signed-off-by: rabollin <rabollin@microsoft.com>

* Multi-run support for workflow

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Removing component folder from run file to match readme

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* aligning state store names on `statestore`

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Adding multi-app run for python and C#

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* pr comments

Signed-off-by: rabollin <rabollin@microsoft.com>

* pr comments

Signed-off-by: rabollin <rabollin@microsoft.com>

* sleep value increase

Signed-off-by: rabollin <rabollin@microsoft.com>

* sleep seconds increase

Signed-off-by: rabollin <rabollin@microsoft.com>

* Result correction

Signed-off-by: rabollin <rabollin@microsoft.com>

* Result correction

Signed-off-by: rabollin <rabollin@microsoft.com>

* java sdk dapr run output format fixing

Signed-off-by: rabollin <rabollin@microsoft.com>

* Syncing Release 1.12 with master and multi-run changes (#936)

* Add holopin.yml config (#923)

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Updating Readme's to default to `dapr run -f .` (#874)

* Updating Invoke readme in C# to favor dapr run -f

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>

* Adding back single app run steps and tests, but to the end.

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Update service_invocation/csharp/http/README.md

Co-authored-by: Mark Fussell <markfussell@gmail.com>
Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>

* Updated and hardened test

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Invoke * and partial PubSub with multi-run files & readmes & tests

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Multi run done for Pubsub C#, Python and Node (http, sdk)

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>

* Added Pubsub support for Go, Java

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>

* updating readmes with correct appid

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>

* Updating tests for PubSub and Service invoke to Paas with multiapp run

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* More fine tuning of pubsub tests (timeouts, step ends)

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Fixing Python FastAPI and C# Pubsub tests

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

---------

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>
Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>
Co-authored-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>
Co-authored-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
Co-authored-by: Mark Fussell <markfussell@gmail.com>

* Patching tests to pass (C# timing, Python uvicorn) (#933)

Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>

---------

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>
Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>
Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>
Co-authored-by: Marc Duiker <marcduiker@users.noreply.github.com>
Co-authored-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>
Co-authored-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
Co-authored-by: Mark Fussell <markfussell@gmail.com>

* Fixing MMD tests with tweaks

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* setting version for kafka (#939)

* fixing version for kafka

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

* validate data with some initial values instead of larger

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

---------

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

* Updating test env to Dapr runtime 1.12 RC4 and CLI RC2

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Update README.md

Fixing typo.  should be singular

Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>

* Update README.md

Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>

* add java workflow quickstart

Signed-off-by: Sky Ao <aoxiaojian@gmail.com>

* Updating runtime for tests to RC5

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Fixes port 6003 conflict between Go Pub-sub and Go bindings.  Timing issue

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* add hello-kubernetes multi-app run k8s template

Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com>

* address review comments.

Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com>

* update cli to rc.4 (#943)

* update cli to rc.3

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

* update cli to rc.4

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

---------

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Signed-off-by: Cassie Coyle <cassie.i.coyle@gmail.com>

* Update CLI to rc4

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Updating .NET SDK to 1.12.*

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Dapr Golang SDK update to v1.9.0-rc-1

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Javascript SDK to 3.1.2

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Release 1.12 (#945)

* Dapr Golang SDK update to v1.9.0-rc-1

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Javascript SDK to 3.1.2

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

---------

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
Co-authored-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Java SDK update to <version>1.10.0-rc-1</version>

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Updated Java SDK to RC, and donated multi-app-run support too :)

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Updating tests to use dapr/dapr 1.12.0-rc.6

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>

* sdk version changes

Signed-off-by: rabollin <rabollin@microsoft.com>

* CLI and Runtime version changes

Signed-off-by: rabollin <rabollin@microsoft.com>

* go.sum refresh

Signed-off-by: rabollin <rabollin@microsoft.com>

* Updating with js-sdk 3.2.0

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

---------

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Signed-off-by: Cassie Coyle <cassie.i.coyle@gmail.com>
Signed-off-by: rabollin <rabollin@microsoft.com>
Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>
Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>
Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>
Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com>
Co-authored-by: Cassandra Coyle <cassie@diagrid.io>
Co-authored-by: Cassie Coyle <cassie.i.coyle@gmail.com>
Co-authored-by: Josh van Leeuwen <me@joshvanl.dev>
Co-authored-by: rabollin <rabollin@microsoft.com>
Co-authored-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
Co-authored-by: Marc Duiker <marcduiker@users.noreply.github.com>
Co-authored-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>
Co-authored-by: Mark Fussell <markfussell@gmail.com>
Co-authored-by: Pravin Pushkar <ppushkar@microsoft.com>
Co-authored-by: Sky Ao <aoxiaojian@gmail.com>
Co-authored-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com>
2023-10-13 16:10:27 -07:00
..
img Delete blank 2023-03-15 16:06:06 -06:00
order-processor Bump csharp sdk to latest RC 2023-09-26 21:09:15 +05:30
README.md Merging `release-1.12` into main branch (#952) 2023-10-13 16:10:27 -07:00
dapr.yaml Merging `release-1.12` into main branch (#952) 2023-10-13 16:10:27 -07:00
makefile Initial push for workflows quickstart 2023-02-05 10:16:05 -07:00

README.md

Dapr workflows

In this quickstart, you'll create a simple console application to demonstrate Dapr's workflow programming model and the workflow management API. The console app starts and manages the lifecycle of a workflow that stores and retrieves data in a state store.

This quickstart includes one project:

  • .NET console app order-processor

The quickstart contains 1 workflow to simulate purchasing items from a store, and 4 unique activities within the workflow. These 4 activities are as follows:

  • NotifyActivity: This activity utilizes a logger to print out messages throughout the workflow. These messages notify the user when there is insufficient inventory, their payment couldn't be processed, and more.
  • ProcessPaymentActivity: This activity is responsible for processing and authorizing the payment.
  • ReserveInventoryActivity: This activity checks the state store to ensure that there is enough inventory present for purchase.
  • UpdateInventoryActivity: This activity removes the requested items from the state store and updates the store with the new remaining inventory value.

Run the order processor workflow

  1. Open a new terminal window and navigate to order-processor directory:
cd ./order-processor
dotnet restore
dotnet build
  1. Run the console app with Dapr:
dapr run -f .
  1. Expected output
== APP == Starting workflow 6d2abcc9 purchasing 10 Cars

== APP == info: Microsoft.DurableTask.Client.Grpc.GrpcDurableTaskClient[40]
== APP ==       Scheduling new OrderProcessingWorkflow orchestration with instance ID '6d2abcc9' and 47 bytes of input data.
== APP == info: WorkflowConsoleApp.Activities.NotifyActivity[0]
== APP ==       Received order 6d2abcc9 for 10 Cars at $15000
== APP == info: WorkflowConsoleApp.Activities.ReserveInventoryActivity[0]
== APP ==       Reserving inventory for order 6d2abcc9 of 10 Cars
== APP == info: WorkflowConsoleApp.Activities.ReserveInventoryActivity[0]
== APP ==       There are: 100, Cars available for purchase

== APP == Your workflow has started. Here is the status of the workflow: Dapr.Workflow.WorkflowState

== APP == info: WorkflowConsoleApp.Activities.ProcessPaymentActivity[0]
== APP ==       Processing payment: 6d2abcc9 for 10 Cars at $15000
== APP == info: WorkflowConsoleApp.Activities.ProcessPaymentActivity[0]
== APP ==       Payment for request ID '6d2abcc9' processed successfully
== APP == info: WorkflowConsoleApp.Activities.UpdateInventoryActivity[0]
== APP ==       Checking Inventory for: Order# 6d2abcc9 for 10 Cars
== APP == info: WorkflowConsoleApp.Activities.UpdateInventoryActivity[0]
== APP ==       There are now: 90 Cars left in stock
== APP == info: WorkflowConsoleApp.Activities.NotifyActivity[0]
== APP ==       Order 6d2abcc9 has completed!

== APP == Workflow Status: Completed

View workflow output with Zipkin

For a more detailed view of the workflow activities (duration, progress etc.), try using Zipkin.

  1. Launch Zipkin container - The openzipkin/zipkin docker container is launched on running dapr init. Check to make sure the container is running. If it's not, launch the Zipkin docker container with the following command.
docker run -d -p 9411:9411 openzipkin/zipkin
  1. View Traces in Zipkin UI - In your browser go to http://localhost:9411 to view the workflow trace spans in the Zipkin web UI. The order-processor workflow should be viewable with the following output in the Zipkin web UI.

What happened?

When you ran dapr run --app-id order-processor dotnet run

  1. A unique order ID for the workflow is generated (in the above example, 6d2abcc9) and the workflow is scheduled.
  2. The NotifyActivity workflow activity sends a notification saying an order for 10 cars has been received.
  3. The ReserveInventoryActivity workflow activity checks the inventory data, determines if you can supply the ordered item, and responds with the number of cars in stock.
  4. Your workflow starts and notifies you of its status.
  5. The ProcessPaymentActivity workflow activity begins processing payment for order 6d2abcc9 and confirms if successful.
  6. The UpdateInventoryActivity workflow activity updates the inventory with the current available cars after the order has been processed.
  7. The NotifyActivity workflow activity sends a notification saying that order 6d2abcc9 has completed.
  8. The workflow terminates as completed.