Skip to content

This repo contains Dapr applications to demonstrate resiliency policies and durable execution with Dapr workflow.

License

Notifications You must be signed in to change notification settings

diagrid-labs/dapr-resiliency-and-durable-execution

Repository files navigation

Dapr Resiliency and Durable Execution

This repo contains Dapr applications to demonstrate Dapr resiliency policies and durable execution with Dapr workflow.

Running the CodeTours in this repo is recommended since this gives more context about:

  • failure and distributed computing challenges
  • the way Dapr provides resiliency
  • what durable execution is
  • how the Dapr Workflow implements durable execution

Table of Contents

Prerequisites

Ensure you have these installed on your machine:

Clone the dapr-resiliency-and-durable-execution repo to your local machine.

Open the cloned repo in VSCode and accept the suggested VSCode extensions.

Running the Dapr Resiliency CodeTour

Using the CodeTour panel in the VSCode explorer, start the 3 - Dapr Resiliency CodeTour:

CodeTour Failure & Resiliency

ResiliencyDemo

The ResiliencyDemo consists of two applications, AppA and AppB, and a state store.

Communication between AppA and AppB can be done using HTTP or Pub/Sub.

Service invocation

graph LR
    A{{AppA}}
    B{{AppB}}
    State[(KV Store)]
    A --HTTP--> B
    B --> State
Loading

Pub/sub

graph LR
    A{{AppA}}
    B{{AppB}}
    MB[Message Broker]
    State[(KV Store)]
    A .-> MB .-> B
    B --> State
Loading

Running the ResiliencyDemo apps locally

  1. Navigate to the ResiliencyDemo folder in the terminal:

    cd ResiliencyDemo
  2. Run the ResiliencyDemo apps using the Dapr CLI:

    dapr run -f .
  3. Open the local.http file in the VSCode editor and execute the HTTP requests to the ResiliencyDemo apps.

Dapr Reliability Advisor in Conductor Free

Diagrid Conductor Free is a free tool developers can use to visualize, troubleshoot, and optimize Dapr workloads on Kubernetes. It includes an Advisor that provides recommendations on how to improve the reliability of your Dapr applications.

Conductor Advisor

Reliability details

Running the Durable Execution & Workflow CodeTour

Using the CodeTour panel in the VSCode explorer, start the 4 - Durable Execution & Workflow CodeTour:

CodeTour Durable Execution & Workflow

WorkflowDemo

graph LR
    KV[(Inventory)]
    WApp{{WorkflowApp}}
    SApp{{ShippingApp}}
    WApp --> SApp
    WApp --> KV
Loading
sequenceDiagram
    actor U as User
    participant DC as DaprClient
    participant W as ValidateOrderWorkflow
    participant UI as UpdateInventory
    participant GSC as GetShippingCost
    participant RS as RegisterShipment
    participant UU as UndoUpdateInventory
    participant KV as KV Store
    U ->> DC: ScheduleNewWorkflowAsync
    DC ->> W: Schedules instance
    DC -->> U: Accepted
    W ->> UI: CallActivity
    UI ->> KV: GetState
    KV -->> UI: Response
    UI ->> KV: SaveState
    UI -->> W: Response
    alt IsSuffientStock
        loop All Shipper Services
            W ->> GSC: CallActivity
            GSC -->> W: Response
        end
        W ->> W: GetCheapestShipper
        W ->> RS: CallActivity
        RS -->> W: Response
        alt Exception from RegisterShipment
            W ->> UU: CallActivity
            UU ->> KV: GetState
            UU ->> KV: UpdateState
            UU ->> W: Response
        end
    end
Loading

Running the WorkflowDemo locally

  1. Navigate to the WorkflowDemo folder in the terminal:

    cd WorkflowDemo
  2. Run the WorkflowDemo apps using the Dapr CLI:

    dapr run -f .
  3. Open the local.http file in the VSCode editor and execute the HTTP requests to the WorkflowDemo apps.

Resources

About

This repo contains Dapr applications to demonstrate resiliency policies and durable execution with Dapr workflow.

Topics

Resources

License

Stars

Watchers

Forks

Languages