Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical Microservices with Dapr and .NET

You're reading from   Practical Microservices with Dapr and .NET A developer's guide to building cloud-native applications using the Dapr event-driven runtime

Arrow left icon
Product type Paperback
Published in Dec 2020
Publisher Packt
ISBN-13 9781800568372
Length 280 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Davide Bedin Davide Bedin
Author Profile Icon Davide Bedin
Davide Bedin
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Section 1: Introduction to Dapr
2. Chapter 1: Introducing Dapr FREE CHAPTER 3. Chapter 2: Debugging Dapr Solutions 4. Section 2: Building Microservices with Dapr
5. Chapter 3: Service-to-Service Invocation 6. Chapter 4: Introducing State Management 7. Chapter 5: Publish and Subscribe 8. Chapter 6: Resource Bindings 9. Chapter 7: Using Actors 10. Section 3: Deploying and Scaling Dapr Solutions
11. Chapter 8: Deploying to Kubernetes 12. Chapter 9: Tracing Dapr Applications 13. Chapter 10: Load Testing and Scaling Dapr 14. Other Books You May Enjoy Appendix – Microservices Architecture with Dapr

The architecture of Dapr

Dapr has been designed from the ground up as a set of pluggable building blocks: developers can create an application counting on the support of many facilities, while operators can adapt applications to the hosting environment by simply intervening in the configuration.

Here is a complete list of the tools and components of Dapr:

  • The Dapr command-line interface (CLI): A cross-platform command-line tool to configure, manage, and monitor the Dapr environment. It is also the tool used to locally debug Dapr applications.
  • The Dapr API: The API that defines how an application can interact with the Dapr runtime in order to leverage its building blocks.
  • The Dapr runtime: This is the core of Dapr that implements the API. If you are curious, you can take a look at how it is developed in Go at Dapr's repository: https://github.com/dapr/dapr.
  • The Dapr host: On your development machine, the host runs as a standalone process; in Kubernetes, it is a sidecar container in your application's pod.
  • The Dapr operator: Specific to Kubernetes mode, the operator manages bindings and configurations.
  • The Dapr sidecar injector: Once instructed via configuration in Kubernetes mode, this takes care of injecting the Dapr sidecar into your application pod.
  • The Dapr placement service: This service has the objective of distributing (or placing) Actor instances across the Dapr pods.
  • Dapr Sentry: A built-in certificate authority (CA) to issue and manage certificates used by Dapr to provide transparent mutual Transport Layer Security (mTLS).

Dapr provides several building blocks that microservice application developers can adopt selectively, based on their needs. These are outlined here:

  • Service invocation: Service-to-service invocation enables your code to call other services located in the same hosting environment while taking care of the retry policy.

    This building block is presented in more detail in Chapter 3, Service-to-Service Invocation.

  • State management: This is to efficiently manage the application state as a simple key-value pair (KVP), relieving your stateful or stateless services of the need to support different backends. Dapr provides many state stores, which include Redis, Azure Cosmos DB, Azure SQL Server, and PostgreSQL, which can be plugged in via configuration.

    You can learn about this building block in Chapter 4, Introducing State Management.

  • Publish and subscribe (pub/sub) messaging: The pub/sub pattern enables decoupled communication between microservices by exchanging messages, counting on the presence of a service bus, which can route messages between producers and consumers.

    A discussion of this building block is presented in Chapter 5, Publish and Subscribe.

  • Resource bindings: This is where the event-driven nature of Dapr shines: with bindings, your application can be triggered by a Short Message Service (SMS) message sent via Twilio (just one of the popular services in this area).

    This building block is presented in more detail in Chapter 6, Resource Bindings.

  • Actors: The actor pattern aims to simplify highly concurrent scenarios by splitting the overall request load between a large number of computation units (the actors), which take care of the job in their smaller, but independent, scope by processing requests to a single actor one at a time. Dapr provides great benefits in this space.

    You can learn about this building block in Chapter 7, Using Actors.

  • Observability: Dapr enables the developer and operator to observe the behavior of the system services and applications without having to instrument them.

    This building block is presented in more detail in Chapter 9, Tracing Dapr Applications.

  • Secrets: It is a common requirement and a healthy practice to keep secrets at a safe distance from the code, even if only to prevent unintended access in a development environment to the connection string intended for the production environment. Dapr enables you to store secrets and to reference these from other Dapr components, in Kubernetes or Azure Key Vault, among many options.

After learning about Dapr architecture and components, before we can start using them, we need to set up Dapr in our development environment, which will be the topic of the next section.

You have been reading a chapter from
Practical Microservices with Dapr and .NET
Published in: Dec 2020
Publisher: Packt
ISBN-13: 9781800568372
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image