Microservices Design Patterns in .NET: Making sense of microservices design and architecture using .NET Core
- Length: 300 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2023-01-13
- ISBN-10: 1804610305
- ISBN-13: 9781804610305
- Sales Rank: #1764853 (See Top 100 Books)
Learn to be deliberate and intentional in your design, technology, and pattern choices when developing an application using a microservices architecture.
Key Features
- Tackle common design problems when developing a microservices application using .NET Core
- Explore applying S.O.L.I.D development principles in developing a stable microservice application
- Use your knowledge to solve common microservice application design challenges
Book Description
Are you a developer who needs to fully understand the different patterns and benefits that they bring to designing microservices? If yes, then this book is for you. Microservices Design Patterns in .NET will help you appreciate the various microservice design concerns and strategies that can be used to navigate them.
Making a microservice-based app is no easy feat and there are many concerns that need to be addressed. As you progress through the chapters of this guide, you’ll dive headfirst into the problems that come packed with this architectural approach, and then explore the design patterns that address these problems. You’ll also learn how to be deliberate and intentional in your architectural design to overcome major considerations in building microservices.
By the end of this book, you’ll be able to apply critical thinking and clean coding principles when creating a microservices application using .NET Core.
What you will learn
- Use Domain-Driven Design principles in your microservice design
- Leverage patterns like event sourcing, database-per-service, and asynchronous communication
- Build resilient web services and mitigate failures and outages
- Ensure data consistency in distributed systems
- Leverage industry standard technology to design a robust distributed application
- Find out how to secure a microservices-designed application
- Use containers to handle lightweight microservice application deployment
Who this book is for
If you are a .NET developer, senior developer, software architect, or DevOps engineer who wants to explore the pros and cons, intricacies, and overall implementation of microservice architecture, then this book is for you. You’ll also get plenty of useful insights if you’re seeking to expand your knowledge of different design patterns and supporting technologies.
Basic experience with application and API development with .NET Core (2+) and C# will help you get the most out of this book.
Cover Title Page Copyright and Credtis Contributors Table of Contents Preface Part 1: Understanding Microservices and Design Patterns Chapter 1: Introduction to Microservices – the Big Picture A deep dive into microservices and its key elements Building a monolith Building microservices Assessing the business need for microservices Scalability Availability Development speed Improved data storage Monitoring Deployment Determining the feasibility of implementing microservices Microservices and .NET Core Summary Chapter 2: Working with the Aggregator Pattern Technical requirements Exploring DDD and its significance Exploring the pros and cons of DDD DDD and microservices The purpose and use of aggregate patterns Aggregates and aggregate roots Relationships in aggregates Handling relationships that span aggregates Aggregates versus entities Entities and why we need them Practical uses of entities in code A rich domain model versus an anemic domain model Understanding and using value objects Summary Chapter 3: Synchronous Communication between Microservices Technical requirements Use cases for synchronous communication Challenges of microservice communication Implementing synchronous communication Implementing HTTP synchronous communication Implementing gRPC synchronous communication HTTP versus gRPC communication Disadvantages of synchronous communication between microservices Summary Chapter 4: Asynchronous Communication between Microservices Technical requirements Functioning with asynchronous communication HTTP asynchronous communication Understanding Pub-Sub communication Understanding message queues Understanding message bus systems Understanding eventual consistency Configuring a message bus (RabbitMQ or Azure Service Bus) Implementing RabbitMQ in an ASP.NET Core web API Implementing Azure Service Bus in an ASP.NET Core API Disadvantages of asynchronous communication between microservices Summary Chapter 5: Working with the CQRS Pattern Technical requirements Why use CQRS for microservices development? Benefits of the CQRS pattern Disadvantages of the CQRS pattern Using the Mediator pattern with CQRS in .NET Implementing a command Creating a command model Creating a command handler Invoking a command Implementing a query Creating a query model Creating a query handler Invoking a query Summary Chapter 6: Applying Event Sourcing Patterns Technical requirements What are events? Key attributes of events What can event sourcing patterns do for me? Pros of event sourcing Cons of event sourcing What are domain events? Domain events and event sourcing Exploring domain events in our application Creating an event store How to store events Implementing event sourcing using a relational database Implementing event sourcing using a non-relational database Reading state with CQRS Summary Part 2: Database and Storage Design Patterns Chapter 7: Handling Data for Each Microservice with the Database per Service Pattern Technical requirements How to make use of the Database-Per-Service pattern A single database technology per service Using different database technologies per service Disadvantages of this pattern Developing a database Relational databases Non-relational databases Choosing a database technology Choosing an ORM Choosing a database development technique Implementing the repository pattern Summary Chapter 8: Implement Transactions across Microservices Using the Saga Pattern Technical requirements Exploring the Saga pattern Issues and considerations Understanding and implementing choreography Rolling back on failure Pros and cons Understanding and implementing orchestration Rolling back on failure Pros and cons Summary Part 3: Resiliency, Security, and Infrastructure Patterns Chapter 9: Building Resilient Microservices Technical requirements The importance of service resiliency Possible failure scenarios and how to handle them Implementing resiliency with caching and message brokers Using a message broker Using a caching layer Using Redis Cache Implementing retry and circuit breaker policies Retry policy with Polly Circuit breaker policy with Polly Summary Chapter 10: Performing Health Checks on Your Services Technical requirements Health checks and microservices The liveness health check Readiness health checks Implementing ASP.NET Core health checks Adding liveness health checks Adding readiness health checks Configuring health probes in orchestrators Summary Chapter 11: Implementing the API and BFF Gateway Patterns Technical requirements What is the API gateway pattern? Advantages of an API gateway Disadvantages of an API gateway Implementing the API gateway pattern Thick API gateways Implementing an API gateway using Azure API Management Implementing an API gateway using Ocelot Adding cache management Adding rate limiting Adding response aggregation Backend for Frontend pattern BFF pattern using Ocelot Summary Chapter 12: Securing Microservices with Bearer Tokens Technical requirements Bearer tokens for securing communications Understanding bearer tokens Implementing bearer token security Securing API with bearer tokens Generating and issuing bearer tokens Using IdentityServer4 to secure microservices Configuring IdentityServer Securing an API using IdentityServer Securing the Ocelot API gateway with IdentityServer Additional API security considerations Summary Chapter 13: Microservice Container Hosting Technical requirements Using containers in microservices development What can containers do for me? Understanding Docker Understanding container images Pros and cons of containers Authoring a Dockerfile Launching a containerized application Using native .NET container support Understanding docker-compose and images Adding docker-compose to a project Publishing containers to a container registry Public versus private container registries Creating and uploading custom images Summary Chapter 14: Implementing Centralized Logging for Microservices Technical requirements Logging and its importance Choosing what to log Using the .NET logging API Adding Serilog Log aggregation and its uses Integrating with Seq Distributed log tracing Enhanced logging for distributed tracing Summary Chapter 15: Wrapping It All Up Aggregator pattern Synchronous and asynchronous communication CQRS Event sourcing patterns Database per service pattern Relational databases Non-relational databases One database for all services One database per service Using the saga pattern across services Resilient microservices Importance of health checks API Gateways and backend for frontend Bearer token security Containers and microservices Centralized logging Summary Index Other Books You May Enjoy
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Microservices Design Patterns in .NET: Making sense of microservices design and architecture using .NET Core
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.