Achraf Ben Alaya
No Result
View All Result
  • News
  • Blog
    • blazor
    • c#
    • Cloud
      • Azure
    • docker
    • sql
    • xamarin
    • Dapr
    • Tricks, Tips and Fixes
  • Cloud
  • Motivation
  • General Tips & Fix
  • Exam Preparation
    • AZ-104
    • AZ-400
  • About
    • Resume
SUBSCRIBE
  • News
  • Blog
    • blazor
    • c#
    • Cloud
      • Azure
    • docker
    • sql
    • xamarin
    • Dapr
    • Tricks, Tips and Fixes
  • Cloud
  • Motivation
  • General Tips & Fix
  • Exam Preparation
    • AZ-104
    • AZ-400
  • About
    • Resume
No Result
View All Result
Achraf Ben Alaya
No Result
View All Result
ADVERTISEMENT
Home Blog Cloud Azure

Dapr – Service Invocation Part 1/2

achraf by achraf
August 17, 2021
in Azure, Blog, Cloud, Dapr
3 min read
0
Dapr – Service Invocation Part 1/2
0
SHARES
339
VIEWS
Share on FacebookShare on Twitter

This part belong to a serie of articles about dapr :

  1. Introduction to dapr
  2. Service Invocation
  3. Publish-Subscribe pub/sub
  4. State management
  5. Hosting using AKS (Azure Kubernetes Services)

In the previous part, we have introduced dapr  ,now we are going to start creating our services one by one for that and as a start  what we need is :

  1. Make sure Docker is running and Dapr services too .
  2. Have .Net  5 Insatlled
  3. Have visual studio installed .

Creating the API :

First of all we are going to create and empty solution and name it as you want to , and than we are need to add a : ASP .NET WEB API project to the solution  or you can just type

dotnet new webapi

The full solution can be found at this link :  https://bit.ly/3s5pz5C

Now, you may run the solution by running the following command :

dotnet run

after that when we go to visit: http://localhost:3902/api/cookies we will get as return a list of cookies

 

Runing the API :

What we really want to do is to run the solution using Dapr for that and in order to expose the cookies api using the dapr sidecar we need to run the command :

dapr run --app-id cookiesstoreapi --app-port 5001  --dapr-http-port 50001 dotnet run

This may be a bit strange for you so let’s explain all the parts of this command :

  • –app-id : each app/service must have a unique ID .
  • –app-port :  in launch settings i changed the parameters so the app runs on port 5001 when I use dotnet run.
  • –dapr-http-port : the port that dapr in listening to for this service.
  • dotnet run : this is how we run dotnet applications

 

Now when we run this cmd we can still get our cookirs from http://localhost:5001/api/cookies but also now we can get them from the side car using : http://localhost:50001/v1.0/invoke/cookiesstoreapi/method/api/cookies .

http://localhost:<dapr-http-port>/v1.0/invoke/<app-id>/method/<method-name>

 

Discovering the Services :

using the follow command we can see the running services by dapr  :

dapr dashboard

On http://localhost:8080/ u will find dapr dashboard that will present to you the running services also the dapr components :

zipkin

When the dapr is working and by veryfing the runing containers, one of them is a Zipkin container, so what is zipkin ?

Zipkin is a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in service architectures. Features include both the collection and lookup of this data.

running: Docker ps will show us the following containers  :

as you can see zipkin is runing on port : 9411

 

Zipkin let you trace your services and show you all the dependencies and we will see that in the next part .

 

ShareTweet
Previous Post

Going Dapr

Next Post

Dapr – Service Invocation Part 2/2

Related Posts

Generating report for SSL Certificates for Websites with PowerShell
Azure

Generating report for SSL Certificates for Websites with PowerShell

April 10, 2022
79
Win a free certifications at the Microsoft spring skills challenge  🎁
Blog

Win a free certifications at the Microsoft spring skills challenge 🎁

March 20, 2022
258
My Trip to Turkey
Blog

My Trip to Turkey

February 5, 2022
161
Microsoft Ignite Cloud Skills Challenge November 2021 :  Learn…and get rewarded (only 3 days left)

Microsoft Ignite Cloud Skills Challenge November 2021 : Learn…and get rewarded (only 3 days left)

November 27, 2021
193
Tools I use with Database
Blog

Tools I use with Database

November 7, 2021
228
Configure postman / newman API tests in Azure DevOps

Configure postman / newman API tests in Azure DevOps

October 25, 2021
1k
Next Post
Dapr – Service Invocation Part 1/2

Dapr - Service Invocation Part 2/2

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Terraform

Certifications

Microsoft certified trainer (MCT)

Recommended

How To Send Mail Using SQL Server

How To Send Mail Using SQL Server

April 20, 2020
183
Migrate and modernize your applications on Azure

Migrate and modernize your applications on Azure

March 26, 2021
260
Goodbye my lover Xamarin, Hello MAUI!

Goodbye my lover Xamarin, Hello MAUI!

September 25, 2020
373
Hello Microsoft Graph !

Hello Microsoft Graph !

February 25, 2021
204
Auto Post and Schedule Tweets & Linkedin using Azure Logic Apps

Auto Post and Schedule Tweets & Linkedin using Azure Logic Apps

April 14, 2021
323
Dapr – Service Invocation Part 1/2

Dapr – Service Invocation Part 1/2

August 17, 2021
339
Facebook Twitter LinkedIn Youtube
Generating report for SSL Certificates for Websites with PowerShell

Generating report for SSL Certificates for Websites with PowerShell

April 10, 2022
Win a free certifications at the Microsoft spring skills challenge  🎁

Win a free certifications at the Microsoft spring skills challenge 🎁

March 20, 2022
My Trip to Turkey

My Trip to Turkey

February 5, 2022

Categories

  • Apps (1)
  • Azure (35)
  • blazor (2)
  • Blog (58)
  • c# (6)
  • Cloud (34)
  • Dapr (4)
  • docker (2)
  • Games (1)
  • General Tips & Fix (1)
  • motivation (2)
  • Motivation (3)
  • News (9)
  • Resume (1)
  • sql (4)
  • Tricks, Tips and Fixes (3)
  • xamarin (5)
No Result
View All Result
  • News
  • Blog
    • blazor
    • c#
    • Cloud
      • Azure
    • docker
    • sql
    • xamarin
    • Dapr
    • Tricks, Tips and Fixes
  • Cloud
  • Motivation
  • General Tips & Fix
  • Exam Preparation
    • AZ-104
    • AZ-400
  • About
    • Resume