Coder Social home page Coder Social logo

aspire-dapr-demo's Introduction

.NET Aspire sample with Dapr

Read the associated blog post: .NET Aspire is the best way to experiment with Dapr during local development.

This is a sample .NET Aspire app host that orchestrates three services:

  1. An ASP.NET Core minimal API named "alice" that uses Dapr service invocation to call the "bob" service in order to retrieve the weather forecast. The results are then cached in a Dapr state store.
  2. An ASP.NET Core minimal API named "bob" that returns weather forecast data, but the endpoint is voluntarily flaky and can return errors. When a weather forecast is successfully returned to a client, the "bob" service will publish an event using Dapr pub/sub.
  3. A Node.js express app named "carol" that listens to the "bob" service events of weather forecasts being published and logs them to the console.
flowchart TD
    A[Alice]
    B[Bob]
    C[Carol]
    SS[State store]

    A --> |Get weather forecast| B
    A --> |Read/write cached weather data| SS
    B -.-> |Notify weather data requested| C

All the services are instrumented using OpenTelemetry to collect traces, logs, and metrics.

Because the "bob" service is flaky, a Dapr resiliency policy is configured to retry the service invocation. The corresponding Dapr resource is loaded by the "alice" service Dapr sidecar.

Requirements

Running the apps

  • Clone this repository.
  • Execute dotnet run inside the AspireDaprDemo.AppHost/ directory.
  • Browse to https://localhost:17262 to open the .NET Aspire dashboard.
  • Click on the first endpoint of the "alice" service to retrieve the weather forecast from "bob" and let "carol" log the event.
  • Use the "Traces" view to monitor the operation.

dashboard_resources

distributed_trace

aspire-dapr-demo's People

Contributors

asimmon avatar

Stargazers

randian  avatar  avatar Esmail Almarrani avatar shengyan.cheng avatar Neil Thompson avatar Simon Donoghue avatar Yandy Zaldivar avatar Rui Carvalho avatar Tuan Cao avatar Peter Šulek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.