Giter Club home page Giter Club logo

pubsub-dapr-csharp-servicebus's Introduction

Microservice communication using pubsub (async)

In this quickstart, you'll create a publisher microservice and a subscriber microservice to demonstrate how Dapr enables a publish-subcribe pattern. The publisher will generate messages of a specific topic, while subscribers will listen for messages of specific topics. See Why Pub-Sub to understand when this pattern might be a good choice for your software architecture.

For more details about this quickstart example please see the Pub-Sub Quickstart documentation.

Visit this link for more information about Dapr and Pub-Sub.

Note: This example leverages the Dapr client SDK. If you are looking for the example using only HTTP click here.

This quickstart includes one publisher:

  • Dotnet client message generator checkout

And one subscriber:

  • Dotnet subscriber order-processor

Pre-requisites

For this example, you will need:

Run Dotnet message subscriber with Dapr

  1. Navigate to the directory and install dependencies:
cd ./order-processor
dotnet restore
dotnet build
  1. Run the Dotnet subscriber app with Dapr:
dapr run --app-id order-processor --components-path ../components/ --app-port 7001 -- dotnet run --project .

Run Dotnet message publisher with Dapr

  1. Navigate to the directory and install dependencies:
cd ./checkout
dotnet restore
dotnet build
  1. Run the Dotnet publisher app with Dapr:
dapr run --app-id checkout --components-path ../components/ -- dotnet run --project .
dapr stop --app-id order-processor

Deploy apps to Azure (Azure Container Apps, Azure Service Bus)

Deploy to Azure for dev-test

NOTE: make sure you have Azure Dev CLI pre-reqs here and are on version 0.9.0-beta.3 or greater.

  1. Run the following command to initialize the project.
azd init --template https://github.com/Azure-Samples/pubsub-dapr-csharp-servicebus

This command will clone the code to your current folder and prompt you for the following information:

  • Environment Name: This will be used as a prefix for the resource group that will be created to hold all Azure resources. This name should be unique within your Azure subscription.
  1. Run the following command to package a deployable copy of your application, provision the template's infrastructure to Azure and also deploy the application code to those newly provisioned resources.
azd up

This command will prompt you for the following information:

  • Azure Location: The Azure location where your resources will be deployed.
  • Azure Subscription: The Azure Subscription where your resources will be deployed.

NOTE: This may take a while to complete as it executes three commands: azd package (packages a deployable copy of your application),azd provision (provisions Azure resources), and azd deploy (deploys application code). You will see a progress indicator as it packages, provisions and deploys your application.

pubsub-dapr-csharp-servicebus's People

Contributors

paulyuk avatar microsoftopensource avatar greenie-msft avatar mukundansundar avatar v-jiaodi avatar microsoft-github-operations[bot] 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.