Skip to content

Latest commit

 

History

History

README.md

Samples

Microservices architecture

This sample was built to demonstrate a microservices architecture with the following components:

  • Server: Connects to storage and exposes it as GRPC endpoints.
  • Api: Exposes REST API to manage orchestrations.
  • UI: Exposes UI to manage orchestrations.
  • OrchestrationWorker: Implements BookParallel, BookSequential, EventDemo, and RewindDemo orchestrations for the given problem.
  • FlightWorker: Implements BookFlight and CancelFlight activities.
  • CarWorker: Implements BookCar and CancelCar activities.
  • HotelWorker: Implements BookHotel and CancelHotel activities.
  • BPMNWorker: An experimental BPMN runner built on top of Durable Tasks. There are also BookParallel and BookSequential BPMN workflows for the given problem.
  • AppHost: Aspire.NET host project to orchestrate and run all applications.

Running the sample

  1. Configure a EFCore storage at the server.

  2. Run the AppHost project with dotnet run or the AppHost sample launch config.

  3. Open Aspire Dashboard at https://localhost:17198/.

  4. Open the DurableTask UI at https://localhost:5002/.

  5. Create the following test orchestrations and watch them be executed:

    Name Version InstanceId Input
    BookParallel v1 (Empty) { }
    BookSequential v1 (Empty) { }
    EventDemo v1 (Empty) { "correlationId": "demo-1" }
    RewindDemo v1 (Empty) { "RequestedCarType": "Sports" }
    BPMN (Empty) (Empty) { "name": "BookParallel" }
    BPMN (Empty) (Empty) { "name": "BookSequential" }
    BPMN (Empty) (Empty) { "name": "Bonus" }
  6. To test external events with EventDemo, raise these events to the running instance:

    Event Name Event Data
    ApprovalRequested { "approved": true, "approvedBy": "alice", "reason": "looks good" }
    AddComment { "text": "approved from UI" }
  7. To test rewind with RewindDemo:

    1. Start RewindDemo with version v1 and input { "RequestedCarType": "Sports" }.
    2. It fails intentionally on the first execution.
    3. Open the instance and click Rewind.
    4. The rewound execution succeeds.

Single service architecture

This sample was built to demonstrate a single service architecture.

  • SingleService: Implements the Client, Worker (just for an orchestration), API and UI.

Running the sample

  1. Run the SingleService project with dotnet run or the SingleService sample launch config.

  2. Create the following test orchestration and watch it being executed:

    Name Version InstanceId Input
    SingleService (Empty) (Empty) { "InputText": "Chadwick" }