Workflow tutorials
Eleven short lessons that build a working knowledge of the workflow builder, one concept at a time. Each lesson shows its complete C# code and, where it defines a workflow, how to write the canonical JSON that the C# compiles to. Every lesson’s code builds with the workflow analyzer on, and every definition passes the engine’s validator.
The examples use neutral business processes: document acknowledgement and review, inventory restock, incident triage, order fulfilment, supplier onboarding, price quotes.
| # | Lesson | Workflow | Topics |
|---|---|---|---|
| 01 | Hello world | AcknowledgeDocument | The workflow class, the start request, the state, one human task |
| 02 | Service tasks | InventoryRestock | endpoint and http calls, results, failure and timeout branches |
| 03 | Decisions | IncidentTriage | WhenExpression, WhenStateFlag, WhenPayloadEquals, nested decisions |
| 04 | Human tasks | DocumentReview, PurchaseRequest | Task roles, payloads, deadlines, sending a task back, roles computed at run time |
| 05 | Sub-workflows | OrderFulfilment, PackOrder, SendInvoice | SubWorkflow and ContinueWith |
| 06 | Advanced patterns | SupplierOnboarding, SupplierDocuments, PriceUpdate | Fork, Repeat, Wait, WaitForSignal, Map |
| 07 | Shared helpers | AddressChange | Payload helpers, flow extensions, and their limits |
| 08 | Expressions | PriceQuote, InvoiceTax | Paths, operators, functions, a function of your own |
| 09 | Testing | - | Definition tests, recording transports, runtime tests on PostgreSQL |
| 10 | Rendering | - | Diagrams as SVG without a host |
| 11 | Changing a workflow | ReturnRequest 1.0.0 and 2.0.0 | A new version while instances of the old one run |
How to use them
- Create a class library that references
StellaOps.Workflow.Abstractions, as in step 1 of Getting started. The package brings the analyzer. - Read the lesson. Its last sections hold the complete code, which compiles as shown, and the line that writes the canonical JSON the code compiles to.
- To run a workflow, register it in a host as in Getting started and start it over HTTP, or in a runtime test (lesson 9).
Reference
- Consumer guides, especially Defining workflows.
- Canonical definitions and the analyzer rules.
- The .NET API reference for the types the lessons use:
IDeclarativeWorkflow<TStartRequest>,WorkflowSpec<TStartRequest>,WorkflowFlowBuilder<TStartRequest>andWorkflowExpr.
