Learning Dapr

Book description

Get the authoritative guide to Dapr, the distributed application runtime that works with new and existing programming languages alike. Written by the model’s creators, this introduction shows you how Dapr not only unifies stateless, stateful, and actor programming models but also runs everywhere—in the cloud or on the edge.

Authors Haishi Bai and Yaron Schneider, both with Microsoft’s Azure CTO team, explain that, with Dapr, you don’t need to include any SDKs or libraries in your user code. Instead, you automatically get flexible binding, state management, the actor pattern, pub-sub, reliable messaging, and many more features. This book shows developers, architects, CIOs, students, and computing enthusiasts how to get started with Dapr.

  • Learn the new programming model for cloud native applications
  • Write high-performance distributed applications without drilling into technical details
  • Use Dapr with any language or framework to write microservices easily
  • Learn how Dapr provides consistency and portability through open APIs and extensible, community-driven components
  • Explore how Dapr handles state, resource bindings, and pub-sub messaging to enable resilient event-driven architectures that scale
  • Integrate cloud applications with various SaaS offerings, such as machine learning

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Resources
    2. Conventions Used in This Book
    3. O’Reilly Online Learning
    4. How to Contact Us
    5. Acknowledgments
  2. Introduction
    1. What Is Dapr?
      1. A Programming Model for a Heterogeneous Environment
      2. More Helpful, Less Opinionated
      3. Don’t Reinvent the Wheel!
      4. Unified Programming Model
    2. Dapr Architecture
      1. Language Support
    3. Getting Started with Dapr
      1. Hello, World! with Dapr Standalone Mode
      2. Hello, World! with Dapr Kubernetes Mode
    4. Using gRPC
      1. Invoking an Application from a gRPC Client
      2. Writing a gRPC Server
    5. Bindings
      1. Binding in Standalone Mode
      2. Binding in Kubernetes Mode
    6. Summary
  3. 1. Services
    1. The World Before Cloud
    2. Cloud Promises and Challenges
      1. Availability
      2. Elasticity
      3. Cloud Native Applications
      4. Infrastructure Is Boring
    3. Service Invocation
      1. Name Resolution
      2. Requests and Responses
      3. Concurrency Control
      4. Service Invocation Experiment
      5. The Universal Namespace
    4. Pub/Sub
      1. Benefits of Message-Based Integration
      2. Pub/Sub with Dapr
      3. How Pub/Sub Works
    5. Dapr Components
      1. Dapr Configurations
      2. Custom Pipelines
      3. Custom Pipeline Experiment
      4. OAuth 2.0 Authorization
      5. Authoring a Custom Middleware
    6. Distributed Tracing
      1. Tracing Middleware
      2. Tracing with Zipkin
      3. Tracing with Azure Monitor
    7. Service Operation
      1. Service Deployment and Upgrade
      2. OAM
    8. Summary
  4. 2. State
    1. State Management
      1. Stateless Versus Stateful
      2. Why Are Stateless Services Preferred in the Cloud?
      3. Challenges of Hosting Stateful Services
      4. Converting Stateful Services to Stateless Services
    2. Dapr State Management
      1. Concurrency Model
      2. Consistency Model
      3. Bulk Operations and Transactions
      4. Multiple State Stores
      5. Retry Policies
    3. The Dapr State API
      1. Key Scheme
      2. Get Requests
      3. Set Requests
      4. Delete Requests
      5. Transactional Requests
    4. Working with the Dapr State API
      1. Data Handling Considerations
      2. Data Querying and Aggregation
    5. State Stores
      1. Redis
      2. Azure Cosmos DB
      3. Etcd
      4. Apache Cassandra
      5. Couchbase
    6. Custom State Stores
      1. Implementing the State API
      2. Updating the Component Registry
    7. Summary
  5. 3. Messaging
    1. Event-Driven Programming
      1. Messages Versus Events
      2. Input Bindings and Output Bindings
      3. Pub/Sub
    2. Pub/Sub with Dapr
      1. Implementing the PowerShell Script
      2. Testing Pub/Sub with the Dapr CLI
      3. Dapr Pub/Sub Behaviors
      4. Extending Dapr Pub/Sub
    3. Input and Output Bindings with Dapr
      1. Using Input Bindings
      2. Using Output Bindings
      3. Implementing Input Bindings
      4. Implementing Output Bindings
      5. Autoscaling with KEDA
    4. Messaging Patterns
      1. The Saga Pattern
      2. Content-Based Routing
      3. Routing Slip
      4. Smart Proxy
      5. MapReduce
    5. Summary
  6. 4. Security
    1. Securing a Distributed Application
      1. Access Control
      2. Data Protection
      3. Secured Communication
      4. Intrusion and Abnormality Detection
    2. Dapr Security Features
      1. Secret Stores
      2. Implementing a Secret Store
      3. The Secret API
      4. Mutual TLS (mTLS)
      5. Dapr mTLS
    3. Summary
  7. 5. Actors
    1. The Actor Pattern
      1. Modern Actor Frameworks
      2. Misuse of the Actor Model
    2. Dapr and Actors
      1. Invoking a Dapr Actor
      2. State Management
      3. Timers
      4. Reminders
    3. Getting Started with Writing Dapr Actors for C#
      1. Defining the Actor Interface
      2. Implementing the Actor Interface
    4. Summary
  8. 6. Application Patterns
    1. Cloud Native Applications
      1. Cloud Environment
      2. Cloud Native Applications with Dapr
    2. System Integrations with Dapr
      1. Distributed Workflow as Finite State Machine
      2. Synchronization
    3. Dapr in a Larger Ecosystem
      1. Yeoman Dapr Generator
      2. Dapr in Visual Studio Code
      3. Dapr with ASP.NET Core
      4. Dapr in a Bigger Application
      5. Dapr and Service Meshes
    4. Dapr on Edge
    5. Summary
  9. 7. Dapr’s Future
    1. Capability Delivery
      1. Architecture
      2. Application Scenarios
    2. Enhanced Actors
      1. Aggregators
      2. Query Interface
      3. Actor Graph
      4. Multiversion Actors
      5. Actor Middleware
    3. The Universal Namespace
      1. Architecture
      2. Application Scenarios
    4. Dapr on Edge
      1. Dapr as a Lightweight Function Runtime
      2. Dapr in WebAssembly
      3. Dapr as a Script
    5. Other Dapr Improvements
      1. Dapr Component Projection
      2. Best Practices and Proven Patterns
      3. Dapr Descriptor
      4. Dapr to Facilitate Multiparty Computing
    6. Summary
  10. Index

Product information

  • Title: Learning Dapr
  • Author(s): Haishi Bai, Yaron Schneider
  • Release date: August 2020
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492072423