Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
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 event-driven runtime

Arrow left icon
Product type Paperback
Published in Nov 2022
Publisher Packt
ISBN-13 9781803248127
Length 312 pages
Edition 2nd 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 (20) Chapters Close

Preface 1. Part 1: Introduction to Dapr
2. Chapter 1: Introducing Dapr FREE CHAPTER 3. Chapter 2: Debugging Dapr Solutions 4. Chapter 3: Microservices Architecture with Dapr 5. Part 2: Building Microservices with Dapr
6. Chapter 4: Service-to-Service Invocation 7. Chapter 5: Introducing State Management 8. Chapter 6: Publish and Subscribe 9. Chapter 7: Resource Bindings 10. Chapter 8: Using Actors 11. Part 3: Deploying and Scaling Dapr Solutions
12. Chapter 9: Deploying to Kubernetes 13. Chapter 10: Exposing Dapr Applications 14. Chapter 11: Tracing Dapr Applications 15. Chapter 12: Load Testing and Scaling Dapr 16. Chapter 13: Leveraging Serverless Containers with Dapr 17. Assessments 18. Index 19. Other Books You May Enjoy

Exploring 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.

The following 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.
  • Dapr Helm charts: It is worth mentioning that Helm charts are provided for a richer experience in installing and updating Dapr in a Kubernetes environment.
  • 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 at 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, and they are as follows:

  • 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 4, 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 5, 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 6, 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 the area of communication API).

This building block is presented in more detail in Chapter 7, 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 8, 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 11, Tracing Dapr Applications.

  • Secrets: It is a healthy practice to keep secrets segregated from the code. Dapr enables you to store secrets and to reference these from other components, in Kubernetes or Azure Key Vault, among many options.
  • Configuration: Introduced in Dapr version 1.8 in Alpha state, this building block addresses the common need to retrieve the configuration data needed by an application.
  • Distributed lock: Introduced with Dapr version 1.8 in Alpha state, it provides a powerful lease-based mechanism to manage mutually exclusive access to a named lock. The lock can be used by the application to assure exclusive access to a resource by many concurrent instances.

After learning about Dapr architecture and components, and 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 - Second Edition
Published in: Nov 2022
Publisher: Packt
ISBN-13: 9781803248127
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