A DotNet Raider

My adventures in the .NET world!
posts - 49, comments - 12, trackbacks - 0

My Links

News

Website View Martino Bordin's profile on LinkedIn

Archives

Post Categories

Dapr

My adventures in the Dapr world
Dapr - The end

Throughout this series of articles, we have explored the various features and abstractions provided by Dapr, such as service invocation, pub/sub, state management, configurations, secrets, resiliency, and observability. However, it's important to note that there are even more capabilities within Dapr that we haven't covered, including actors, workflow management, distributed locks, and hosting. Given the extensive nature of Dapr and its continuous growth, it's challenging to capture every aspect in a limited series of articles. To gain a deeper understanding, I encourage you to explore the official documentation, read relevant books, and explore additional online resources like GitHub projects...

posted @ mercoledì 17 aprile 2024 09:37 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - Observability

Monitoring a distributed system is important to identify potential failures, security issues, bottlenecks and in general to understand how our application is performing to apply remediations (that could be scaling or redesigning some parts). In a distributed system, with several interconnected components, a dynamic environment, and unreliable networks, this becomes challenging. Dapr, with his runtime running as a "sidecar", is the central point where the instrumentation of monitoring takes place to have distributed tracing, logging, metrics, and health check; as everything in Dapr, we can just configure these features using a YAML file. In our sample, we'll use...

posted @ lunedì 25 marzo 2024 10:46 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - Resiliency

As we know, in a distributed system we have to take into account more complexity and deal with its fallacies. Since several moving parts could potentially be broken or be unreachable, we must design upfront our application with resiliency in mind, to minimize the impact of bad events and continue operating. Dapr gives us out-of-the-box features that allow our applications to handle temporary failures. All we have to do is to create a YAML file where we define policies and targets. Policies are how we want to handle errors: Timeout,  to terminate operations...

posted @ lunedì 5 febbraio 2024 10:27 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - Secret management

Dapr Secrets management is a feature that provides a secure and scalable way to manage application secrets, such as API keys, passwords, and tokens. You can use different cloud providers and environments such as Azure Key Vault, AWS Secrets Manager, HashiCorp Vault, or Kubernetes Secrets. In our example, we'll use a JSON file (not recommended in production!) to store the following secrets: "httpbindingtoken": "my auth token",   "ConnectionStrings": {     "SqlServer": "Server=sqlserver;Database=CustomersDb;User Id=sa;Password=admin12345!;TrustServerCertificate=true",     "PostgreSQL": "Server=postgres;Port=5432;Database=ProductsDb;User Id=admin;Password=admin12345;",     "MongoDb": "mongodb://mongo:27017"   },   "MongoDb": {     "DatabaseName": "OrderDb",     "OrdersCollectionName": "Orders"   } } We have two way to retrieve them: declaratively, in...

posted @ venerdì 12 gennaio 2024 15:29 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - Pub/sub & Output Binding

In the last article, once created an order we published a message, called OrderSubmittedIntegrationEvent with all the relevant information. How can we subscribe to this event in other services? In Dapr there are two ways: declaratively, where subscriptions are defined in an external file programmatically, where subscriptions are defined in our code We're going to use the second method in the Notifications and Shipping microservices along with the Output binding building block What is an Output binding? It's a way to invoke external resources just by passing...

posted @ mercoledì 6 dicembre 2023 16:53 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - Service invocation & Pub/sub

Dapr service discovery & invocation is a feature that allows services to discover and call other services using HTTP or gRPC protocols, providing a simple and consistent way to invoke them. Communication is also secure (with mutual mTLS authentication) resilient (with configurable retry\circuit breaker\timeout policies) traced and metered (using common protocols) controlled (we can use ACL to restrict accesses\permissions to some APIs) balanced (using round-robin) The pub/sub is a messaging pattern where a message is published by...

posted @ sabato 4 novembre 2023 12:39 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - Input Binding and Configuration

Dapr binding is a mechanism that allows connections between components and external services by providing a common interface for communication, without needing to know about each other's implementation details. It allows components to send and receive messages over a range of transport protocols and message brokers, like RabbitMQ and Kafka, Azure Event Grid, AWS SNS, Azure Service Bus, and Amazon SQS. You can also integrate with Twitter, SMTP, SendGrid, HTTP, or CRON. Dapr has a building block also to manage and retrieve the application configurations (settings, connection strings, identifiers, etc) just by configuring the related component. At...

posted @ martedì 10 ottobre 2023 08:37 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - State management

Dapr allows the storage of durable data (key\value pairs) across multiple sessions and services. With Dapr State Management, you can: Save and retrieve state using different stores with 2 levels of consistency (strong and eventual) Use a consistent API to perform operations, abstracting away the implementation details. Implement caching (with TTL) to improve performance. Filter\Sort\Page state entries Let's see how we can use it in the customer's microservices. The customers' microservice persists data in MS SQL Server and...

posted @ mercoledì 6 settembre 2023 15:54 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - Create a Dapr service

In order to use Dapr with C#, you just have to create a new ASP.NET Core Web API Project and reference the Nuget package Dapr.AspNetCore Once done, just go in the Program.cs and chain the method AddDapr() after the method AddControllers(): builder.Services.AddControllers().AddDapr(); In addition to that, just call these methods to register the Pub\Sub building block: app.MapSubscribeHandler(); app.UseCloudEvents(); At this point, you can inject the DaprClient, in your controller or services, to interact with the several APIs of Dapr. public CustomersController(DaprClient daprClient) { this.daprClient = daprClient; } We then can run the application along with Dapr sidecar using...

posted @ lunedì 3 luglio 2023 07:19 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - The application scenario

In this series of articles (source code is available on GitHub), we'll develop a microservices application for an imaginary food delivery company called "MicroDelivery". We'll have several services, each with its own logic, that will interact via RPC call or pub\sub messaging and we'll see how to use Dapr to build it. ⚠️ Disclaimer My goal here is to give you a birds-eye view of the different features of Dapr, not to guide you step by step on building an application from scratch, nor to explain the single details of Dapr (there's the official...

posted @ lunedì 5 giugno 2023 16:09 | Feedback (0) | Filed Under [ Dapr Microservices ]

Dapr - An introduction to the runtime

Dapr, standing for Distributed Application Runtime, is an open-source event-driven runtime that simplifies the building of resilient microservices-based applications. It's designed to work with any programming language, any infrastructure, and any cloud provider (Azure, AWS, GCP) and it's part of the Cloud Native Computing Foundation (CNCF) project. Its main goal is to abstract the complexity of distributed systems and allows developers to focus on business logic rather than the underlying infrastructure (warning: just because the complexity is 'hidden' doesn't mean you should not be aware of what it is and how you would solve it). These abstractions...

posted @ lunedì 29 maggio 2023 16:20 | Feedback (0) | Filed Under [ Dapr Microservices ]

Powered by:
Powered By Subtext Powered By ASP.NET