This eBook includes the following formats, accessible from your Account page after purchase:
EPUB
The open industry format known for its reflowable content and usability on supported mobile devices.
PDF
The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Also available in other formats.
Learn to Design and Build Scalable Message-Driven Systems
In today's fast-paced digital landscape, businesses must adapt rapidly to evolving demands. Message- and Event-Driven Systems with CQRS and Event Sourcing reveals how modern message-driven web and cloud architectures can fuel digital transformation, drive agility, and ensure robust scalability. This book bridges the gap between theory and practice, empowering architects and developers to build systems that thrive in the cloud era.
This book demystifies a collection of widely discussed architectural patterns, clearly distinguishing between message-driven, event-driven, CQRS, and Event Sourcing approaches, and showing precisely when to apply each. By untangling concepts that are often confused, it provides both a strategic overview and practical guidance for designing a system and its components.
Unlike most resources that focus on Java or C#, this book leverages Node.js, JavaScript, and TypeScript, making it uniquely relevant for today's web and cloud developers. Readers will discover how to isolate business capabilities, accelerate time-to-market, and future-proof their technology stack, enabling continuous evolution without sacrificing stability or performance.
Build the architectural knowledge that distinguishes scalable systems and start architecting for inevitable change with patterns that matter.
Series Editor Foreword xvii
Preface xxi
Chapter 1: Business Strategy Meets Message-Driven Systems 1
Why Businesses Benefit 2
How Domain-Driven Scenarios Are Solved 3
How Businesses Can Thrive in the Face of Constant, Rapid Change 5
Message-Driven Architecture 6
Loose Coupling 9
Relationship to Reactive Architecture 10
Relation to Monoliths and Microservices 10
Domain-Driven Running Example 12
Modeling Messaging Systems 15
Summary 22
References 23
Chapter 2: Anatomy of Message-Driven Systems 25
Message Broker 26
Synchronous Communication 34
The Structure of Messages 36
Message Categories 39
Serialization, Schemas, and Types in Code 48
Guarantees in Distribution 57
Ordering of Messages 65
Dealing with Duplicates 67
Error Handling 71
Summary 76
References 76
Chapter 3: In-Context Architectures 79
The Purpose of Layers 80
Dependency Inversion 82
Ports and Adapters 89
Generic Layouts and Guided Designs 92
The Four Standard Layers 95
Architecture for the Running Example 106
Summary 107
References 108
Chapter 4: Tactical Building Blocks 109
Value Objects 110
Identities 116
Entities 119
Domain Services 124
Repositories 126
Domain Events 136
Aggregates and Eventual Consistency 147
Summary 162
References 163
Chapter 5: CQRS 165
When Business Software Should Segregate Responsibilities 166
Commands and Queries 170
Command Model and Query Models 175
Model Synchronization 180
Technical Segregation 190
Initializing and Evolving Query Models 195
Eventual Consistency in the User Interface 201
Dos and Donts 203
Summary 205
References 206
Chapter 6: Event Sourcing 207
Your Business as Auditable History 208
Modeling State as Events 211
Event-Sourced Command Model 215
Event Store 222
Comparison of Store Technologies 234
Query Model Projections 246
Processing and Publishing Events 259
Data Deletion 265
Summary 266
References 267
Chapter 7: Long-Running Processes 269
What Is a Process? 270
Message-Driven Processes 278
Choreography 284
Orchestration 290
Correlation of Messages 305
Process as a Domain Model Component 308
Evolution of Long-Running Processes 315
Summary 318
References 319
Chapter 8: Evolution of Messages and Message Streams 321
Purpose and Scope Determine Life Cycle 322
Relation of Data, Serialization, Schemas, and Types 327
Types of Message Changes 332
Adaptation Techniques 338
Evolution of Persistent Message Streams 347
Schema Registries 354
Summary 357
References 358
Chapter 9: Composing Data from Different Sources 359
Global Message Journal 360
Replicating Query Models 370
Synchronous On-Demand Composition 389
The "Right Way" to Compose Query Models 399
Summary 399
References 400
Chapter 10: Message-Driven User Interfaces 401
Frontend Architecture 402
Messaging Technologies and Protocols 406
Executing Commands and Queries 418
Reacting to Events 424
Building Reactive Query Models 428
Client-Side Projections of Change Events 432
Summary 434
References 434
Index 435
