
Master event driven microservices with CQRS, saga and event sourcing patterns for scalable, loosely coupled architectures. Explore database per service, API composition, materialized views, and transactional outbox in hands-on demos.
Explore the database-per-service pattern in microservices, illustrating separate databases per service, benefits like loose coupling and independent scaling, and challenges such as cross-service queries and distributed transactions.
Explain cross-service queries in a database-per-service setup and apply the API composition pattern to fetch data from multiple microservices, then aggregate and present a unified UI profile.
Learn how the API composition pattern handles queries by aggregating data from provider services through an API composer and gateway, with caveats and when to prefer CQRS for data manipulation.
Explore api composition with Spring Cloud Gateway across microservices like customers, accounts, loans, and cards, connected by Eureka and gateway edge, using a bom-driven dependency management approach.
Explore the accounts microservice by inspecting the business logic in AccountServiceImpl, including creating, fetching, updating, and soft-deleting accounts with 10-digit mobile number validation and auditing.
Start microservices in order, register them with Eureka, and route requests through the gateway to accounts, cards, customer, and loans. Test CRUD operations with postman and verify h2 data persistence.
Use Spring Cloud Gateway to implement api composition, aggregating customer, accounts, loans, and cards data into a customer summary via dto objects and feign clients in a mono reactive flow.
Implement api composition in a reactive gateway using web client, web client adapter, and http service proxy factory to aggregate customer, accounts, loans, and cards into a single customer summary.
implement the api composition pattern in a reactive spring cloud gateway by routing a get to /api/composite/fetch/customerSummary with json input and a mobileNumber query param, aggregating microservice responses.
Explore data consistency and complex transactions in a database per service pattern for microservices, using examples from order, payment, and inventory, and learn the Saga pattern as a solution.
Explore the data duplication challenge in microservices and how event-driven architecture, with cqrs, saga, and event sourcing, unifies updates across customer, account, card, and loan services.
Explore the CQRS pattern and event sourcing concepts, including separating write and read databases, command and query responsibilities, and using an event bus to achieve eventual consistency.
Explore the CQRS pattern's benefits and trade-offs: scalable separate read/write databases, optimized data models, projections, event sourcing with audit trails, plus complexity and eventual consistency.
Explore how the event sourcing pattern stores every change as events in an event store, enabling auditability, replayability, and current state views via CQRS, aggregates, and projections.
Discover how cqrs and event sourcing partition microservices into write and read models, publish events to an event bus, and leverage Axon IQ for monitoring.
Set up Axon Server locally with docker using axonserver.properties to configure port 8024, host, and dev mode, then mount config, data, and events volumes and access the dashboard.
Set up axon server and integrate axon framework to enable cqrs and event sourcing across microservices, and add axon spring boot starter dependencies in customer and accounts.
Create command classes in the customer microservice to support CQRS, including CreateCustomerCommand, UpdateCustomerCommand, and DeleteCustomerCommand, with Axon server integration via application.yml and REST APIs.
Create a FindCustomerQuery on the query side for a single read operation using mobileNumber, with @Value, aligning CustomerCreatedEvent, CustomerUpdatedEvent, and CustomerDeletedEvent to update the read database via the event bus.
Build rest command APIs for create, update, and soft delete in the customer microservice using a separate command controller, command gateway, and event sourcing with Axon.
Explore the technical flow of cqrs and event sourcing, detailing commands, aggregates, projections, and how write APIs trigger commands and update the read database via axon.
Create a customer aggregate with Axon, handle CreateCustomerCommand in a @CommandHandler constructor, validate duplicates via the read database, and publish CustomerCreatedEvent with copied data using apply for event sourcing.
Implement update and delete commands in CustomerAggregate with @CommandHandler methods, publish CustomerUpdatedEvent and CustomerDeletedEvent via apply, and restrict updates to name and email in the write model.
Build a projection class in the customer microservice on the query side, handling customerCreatedEvent, customerUpdatedEvent, and customerDeletedEvent with @EventHandler to update the read database.
Demonstrate end-to-end CQRS and event sourcing in a customer microservice using Axon server, including write and read databases, events, commands, and queries.
Install the Axon Framework IntelliJ plugin to boost productivity in Axon-based microservice development, then navigate from commands to events and handlers using plugin arrows for quick insight.
Implement and validate commands before handling them with Axon's MessageDispatchInterceptor, via a CustomerCommandInterceptor that validates create, update, and delete commands using repository checks.
Register the customer command interceptor with the CommandGateway by invoking registeredDispatchInterceptor via ApplicationContext.getBean, enabling pre-handle validations such as duplicate mobile numbers.
Learn to read events from the EventStore to validate update commands, using Axon Framework’s EventStore with readEvents, streaming to a list, and enforce business rules without disrupting existing interceptor logic.
Explore how runtime exceptions affect read-side projections and rollback behavior in an Axon CQRS event flow, and compare subscribing versus streaming event processors for single versus multi-jvm deployments.
Publish multiple events from a single command using Axon apply, group related events into processing groups, and choose subscribing or streaming event processors for threading and error handling.
Configure Axon event processors with a subscribing processor and the customer-group processing group to enable rollback from the event side to the command side, with error propagation.
Implement the cqrs and event sourcing pattern in the accounts microservice by adding command and query structures, aggregate, controllers, interceptor, and projection, following the customer microservice guide.
Implement cqrs and event sourcing in the accounts microservice by building the query side with FindAccountQuery, projection, a query handler, and an accounts query controller.
Implement cqrs and event sourcing in cards and loans microservices, using command and query patterns, a read-write database separation, and api composition with axon server.
Explore cqrs flavors, from a single read/write model on one database to separate command and read models, to distinct databases synchronized by an event bus or by cdc with Debezium.
Explore the need for the materialized view pattern to address cross-service queries, gateway aggregation drawbacks, and performance latency in event-driven microservices.
Implement a materialized view pattern across the customer, accounts, cards, and loans microservices with a profile microservice maintaining a unified profile table keyed by mobileNumber.
Implement the materialized view pattern by creating a profile microservice focused on the query side, renaming packages, updating configuration to connect to the Axon server, and preparing profile data mapping.
Introduce materialized view pattern by centralizing shared events and dispatching customer, account, loan, and card data changed events across microservices with Axon apply and event gateway.
Publish data changed events to drive the profile materialized view pattern, with profile projection and event handlers in an event driven cqrs architecture.
Reset the Axon server and microservices, validate events across the profile via the materialized view, and configure a common Axon setup to enable serialization.
Demonstrates the materialized view pattern across microservices by syncing customer, accounts, loans, and cards. Explores use cases like cross-service queries, data sharing, and analytics.
Explore the transactional outbox pattern, which writes to an outbox table within a transaction and uses a polling process to publish events to Kafka, enabling decoupled, reliable, scalable data streaming.
Learn how the saga pattern solves data inconsistency in distributed microservice transactions, illustrated by a travel booking across car, hotel, and flight services.
Explains how the saga pattern maintains data consistency across distributed microservices by breaking transactions into smaller independent steps and applying compensating actions in reverse order.
Explore the benefits and drawbacks of the saga pattern, including data consistency, scalability, resiliency, and flexibility between choreography and orchestration, plus challenges in eventual consistency, complexity, testing, and debugging.
Demonstrate the choreography saga pattern by updating a mobile number across four microservices—customer, accounts, cards, loans—using T1 to T4 with compensation transactions and asynchronous messaging via RabbitMQ or Kafka.
Learn to implement the choreography saga pattern with spring projects, using spring cloud stream and spring cloud functions for event driven microservices with rabbitmq; create mobileNumberUpdateDto and a patch API.
Showcases the choreography saga pattern by adding an updateMobileNumber flow in the customer service and publishing an event to the accounts microservice via Spring Cloud Functions and StreamBridge over RabbitMQ.
Implement choreography saga pattern by wiring account, card, and loans microservices with spring beans, logging, and stream bridge publishing mobile number updates to RabbitMQ.
Demonstrate a choreography saga for mobile-number updates across customer, accounts, cards, and loans microservices using Spring Cloud Function and Spring Cloud Stream with RabbitMQ, publishing updateMobileNumberStatus events to finish flow.
Demonstrate a six-microservice saga flow with rabbitmq, updating a mobile number across customer, accounts, cards, and loans, achieving a happy flow with synchronized data.
Explore implementing compensation transactions in an event-driven microservice architecture, using @Transactional and rollback logic to coordinate customer and account services during mobile number updates.
Implement compensation transactions across cards, accounts, loans, and customers by rolling back the card service data and triggering compensations in the account and customer microservices.
Demonstrate a complete choreography saga in a CQRS-based microservices setup by triggering a loans service exception to cascade compensations across cards, accounts, and customers, with Postman and gateway testing.
Introduce the orchestration saga pattern and contrast it with choreography, detailing a central saga manager that sequences microservice updates and compensations across writer and reader databases.
Extend the cqrs and event sourcing codebase by implementing the orchestration saga pattern across customer, account, card, and loan services with new commands, events, and axon configuration.
Implement a patch rest api in the customer microservice to update mobile numbers, dispatching updateCustomerMobileNumber commands and publishing customerMobileNumberUpdatedEvent through a saga with event sourcing and projection.
Implement an orchestration saga pattern with StartSaga and EndSaga annotations, dispatching updateAccountMobileNumber via command gateway and forwarding to next microservice, while rolling back on the customer microservice if failures occur.
Implement an orchestration saga to propagate a mobile number update across accounts, cards, and loans using commands, events, event sourcing, and compensation with end saga.
Builds compensation transactions in the saga by handling rollback commands for card, account, and customer mobile number updates, with rollback events and end-saga handling.
Demonstrates an orchestration saga pattern across microservices using Axon, CQRS, and event sourcing, showing mobile number update via saga events and rollback compensation.
Explore subscription queries in the Axon framework to surface the overall status of a saga, showing initial state and ongoing updates via a query gateway and ResponseDto.
Demonstrates wiring a saga manager to emit subscription query results with QueryUpdateEmitter, using findUpdateMobileSagaQuery and FindCustomerQuery, and sending ResponseDto with 200 on success and 500 on failure.
Learn how the event sourcing pattern, combined with CQRS, uses an aggregator to replay past events to compute the current state and how snapshots mitigate write-time performance.
Watch a demo of event replay in the aggregator, tracing customer created and updated events, logging event objects, and storing new events in the event sourcing storage system.
Snapshots in event sourcing enable state restoration from a snapshot plus subsequent events, boosting performance and scalability. Configure snapshots to balance storage, frequency, and integrity in high-volume scenarios.
Configure snapshots in event sourcing with Axon using event-count or load-time triggers. See a live demo of creating and replaying snapshots in a customer microservice.
Celebrate completing the event driven microservices patterns course and invite learners to share feedback and connect with the instructor via email or LinkedIn.
Unlock the power of modern, event-driven microservices architecture with Spring Boot and the Axon Framework in this hands-on, project-based course. Dive deep into advanced patterns like CQRS (Command Query Responsibility Segregation), Saga, Event Sourcing, and essential microservices design principles to build robust, scalable applications.
This course is designed for developers and architects eager to gain expertise in building complex, distributed systems using event-driven patterns. From designing domain-driven services to managing data consistency across services, you’ll learn to address real-world challenges while creating resilient and high-performance microservices.
What You’ll Learn:
Event-Driven Architecture Fundamentals: Master the foundations of event-driven design and understand when to use it in microservices.
Implementing CQRS: Understand the Command Query Responsibility Segregation (CQRS) pattern, separating read and write concerns for optimized performance and scalability.
Handling Complex Business Transactions with Sagas: Learn to coordinate distributed transactions across multiple microservices using the Saga pattern, ensuring consistency without traditional locking mechanisms.
Event Sourcing: Capture every state change in an event log for an immutable record of historical data and easier debugging, replay, and auditability.
Database-per-Service Pattern: Maintain data independence for each microservice using separate databases, enabling easier scaling and independent deployment.
API Composition Pattern: Create aggregated, composite APIs at the gateway level to simplify client interactions with multiple services.
Materialized View Pattern: Use read-optimized views for efficient querying, ensuring responsive and scalable data access in CQRS-based applications.
Transactional Outbox Pattern: Ensure data consistency by safely publishing events from within your transaction boundary, eliminating potential data synchronization issues.
Key Technologies Covered:
Spring Boot: Build and deploy microservices with the popular Spring Boot framework.
Axon Framework: Leverage the Axon Framework’s powerful toolkit to implement CQRS and event-sourcing patterns.
Message Brokers: Integrate with message brokers for reliable event publishing.
Microservices Best Practices: Use design principles, patterns, and tools to enhance resilience, performance, and scalability.
Hands-On Learning:
This course is packed with real-world examples, hands-on exercises, and guided projects to solidify your skills. You’ll walk away ready to apply these advanced patterns in real projects, design robust microservices, and tackle common challenges in event-driven architectures with confidence.
Who Should Enroll:
Software developers and architects interested in advanced microservices design.
Engineers seeking hands-on experience with CQRS, Saga, Event Sourcing, and other cutting-edge patterns.
Developers looking to learn Spring Boot and the Axon Framework to build event-driven systems.
By the end of this course, you’ll be fully equipped to design and develop sophisticated, event-driven microservices that handle complex data consistency challenges with ease, providing a solid foundation for any high-scale, high-resilience distributed application.