Key Architectural Patterns in Microservices – DDD, CQRS, and Event Sourcing
This chapter is all about appreciation of the backbone of microservices – the central patterns that make our software designs strong, scalable, and effective.
So first off, we’ll want to delve into the world of domain-driven design. It’s an approach to software that fits business concerns to any given software project. It’s akin to ensuring our software speaks the same lingo as the business challenges it’s working to answer.
Coming up is Command Query Responsibility Segregation. It’s a nice way to divide how we manipulate data in two – one for updating and another for retrieving. It divides our software duties in a cleaner, more efficient way.
Next, there is Event Sourcing. We record each change as a series of events here. It is like an itemized account of everything that has happened – one which can be very powerful for looking back at the history of our data and choices.
As we progress through this chapter, we will understand why architectural patterns are important and how to apply them in order to build our microservices correctly. We will learn not only what architectural patterns are but their practical application as well. In this chapter, we’re going to cover the following main topics:
- Introduction to architectural patterns in microservices
- Domain-Driven Design (DDD)
- Command Query Responsibility Segregation (CQRS)
- Event Sourcing
- Brief overview of other architectural patterns