Software Engineering


Event-Driven Microservices, CQRS, SAGA, Axon, Spring Boot

Learn to build distributed Event-driven Microservices, CQRS, Event Sourcing, SAGA, Transactions

4.60 (468 reviews)


9 hours


May 2021

Last Update
Regular Price

What you will learn

Event-Driven Microservices

Basics of Spring Cloud

Axon Framework

Eureka Discovery Service

CQRS Design Pattern

Spring Cloud API Gateway

SAGA Design Pattern

Event Based Messages



In this video course, you will learn how to build business logic that spans several distributed Spring Boot Microservices

This course is designed for beginners and we will start from the basics of Microservices, Spring Boot, and Spring Cloud.

You will learn how to create your very first Spring Boot Microservice and how to handle HTTP requests. You will then learn how to run multiple instances of your Microservice behind an API Gateway and how to make them discoverable. This will help you scale up your microservice up and down as needed.

This video course will also cover transactions across multiple distributed Microservices and how to roll back changes if an error took place. Transactions is an advanced topic and to be able to build transactional microservices this video course will teach you a few more design patterns. Starting from the very beginning, you will learn how to develop event-based Microservices that are absolutely location transparent.

You will learn how to use a modern and very popular framework for building event-based Microservices called Axon. Axon Framework is based on design principles such as CQRS(Command Query Responsibility Segregation) and DDD(Domain Driven Design). You will learn how to build event-based Microservices using Axon Framework and how to use CQRS and Event Sourcing in your Microservices.

Finally, you will learn about the Saga design pattern and how to group multiple operations into a single transaction. This will help you build business logic that spans multiple distributed Microservices and roll back changes if one operation fails.

All from the very beginning, to make these advanced topics easier.


Event-Driven Microservices, CQRS, SAGA, Axon, Spring Boot
Event-Driven Microservices, CQRS, SAGA, Axon, Spring Boot
Event-Driven Microservices, CQRS, SAGA, Axon, Spring Boot
Event-Driven Microservices, CQRS, SAGA, Axon, Spring Boot




Source code

What if I have questions?

Microservice vs Monolithic application

Microservices Architecture Overview

Transactions in Microservices

Choreography-Based Saga

Orchestration-Based Saga

Frameworks that we can use

(CQRS)Command Query Responsibility Segregation

Event Sourcing

Axon Framework and Axon Server



Download and run Docker Desktop

Spring Tool Suite

Download and Install Postman HTTP client

Creating a Basic Microservice


Creating a new project. Products Microservice.

Creating a Rest Controller class

Handle HTTP POST, GET, PUT and DELETE Requests

Trying how it works

Eureka Discovery


Creating new project

Configure project as Eureka Server

Registering Microservices with Eureka

Trying how it works

Spring Cloud API Gateway & Load Balancing


Creating Spring Cloud API Gateway project

Automatic Routing with Resource Locator

Random Port Number

Starting Multiple instances of Products Microservice

Trying how load balancing work

Axon Server - Getting Started


Download and run Axon Server as JAR application

Axon Server configuration properties

A complete list of Axon Server configuration properties

Run Axon Server in a Docker container

Running Axon Server in Docker Blog Post

Start, Stop, Delete Axon Server Docker Container By ID

Configure Axon Server running in Docker Container

CQRS Pattern. Products Microservice.


Accept HTTP Request Body

Trying how it works

Adding Axon Framework Spring Boot Starter

Creating a new Command class

Creating a new CreateProductCommand object

Send Command to a Command Gateway

Product Aggregate - Introduction

Creating ProductAggregate class

Validate the CreateProductCommand

Creating ProductCreatedEvent

Apply and Publish the Product Created Event


Adding Additional Dependency

Trying how it works

Previewing Event in the EventStore

CQRS. Persisting Event in the Products database.


Adding Spring Data JPA & H2 dependencies

Configure database access in the application.properties file

Creating an ProductEntity

Creating ProductRepository

Creating Products Events Handler/Projection

Implementing @EventHandler method

Trying how it works

Preview Product record in a database

CQRS. Querying Data


Creating Rest Controller

Refactor Command API Rest Controller

Get Products web service endpoint

Querying the QueryGateway

Creating ProductsQueryHandler

Implementing the findProducts() method

Trying how it works

Validating Request Body. Bean Validation.

Introduction to Bean Validation

Bean validation. Enable Bean Validation.

Bean validation. Validating Request Body.

Hibernate Validator Documentation

Trying how the Request Body Validation works.

Validation in the @CommandHandler method


Command validation in the Aggregate

Validation. Message Dispatch Interceptor.

Introduction to Message Dispatch Interceptor

Creating a new Command Interceptor class

Register Message Dispatch Interceptor

Trying how the Command Interceptor works.

Validation. How to check if record exists?

Set Based Consistency - Introduction

Creating Product Lookup Entity

Creating Product Lookup Repository

Creating a ProductLookupEventsHandler

Persisting information into a ProductLookup table

Updating MessageDispatchInterceptor

Trying how the Set base validation works

Handle Error & Rollback Transaction


Creating a centralized Error Handler class

Trying how the centralized error handler class works

Return custom error object

Handle the @CommandExecutionException

Trying to handle the @CommandExecutionException


Creating the ListenerInvocationErrorHandler

Register the ListenerInvocationErrorHandler

Trying how transaction rollback works

Assignment. Orders Microservice.



Orchestration-based Saga. Part 1. Reserve Product in Stock.


Saga class structure overview

Creating OrderSaga class

@SagaEventHandler method for the OrderCreatedEvent

Creating a new Core API module

Adding Core project as a dependency to OrdersService

Creating the ReserveProductCommand

Publish the ReserveProductCommand

Handle the ProductServeCommand in the ProductsService

Publish the ProductReservedEvent

Updating Products projection

Handle the ProductReservedEvent in Saga

Trying how it works

Saga. Part 2. Fetch Payment Details.




Fetching User Payment Details

Trying how it works

Saga. Part 3. Process User Payment.

Creating the ProcessPaymentCommand

Publish the ProcessPaymentCommand



Handle the PaymentProcessedEvent

SAGA. Part 3. Approve Order.

Create and publish the ApproveOrderCommand

Handle the ApproveOrderCommand

Create and publish the OrderApprovedEvent

Handle the OrderApprovedEvent and update Orders database

Handle the OrderApprovedEvent in OrderSaga class

Trying how it works

SAGA. Compensating Transactions.


Creating the CancelProductReservation command

Publish the CancelProductReservationCommand

Handle the CancelProductReservation command in ProductsService

Create and publish the ProductReservationCancelledEvent

Handle the ProductReservationCancelledEvent

Create and publish the RejectOrderCommand

Handle the RejectOrderCommand on the query side

Create, publish and handle the OrderRejectedEvent

Trying how it works



Creating a DeadlineManager object

Schedule a deadline

Handle deadline

Cancel deadline

Trying how it works

Next steps

What's next?


Vinod3 July 2021

This is a good starting point for event driven and cqrs based microservice development with spring boot.

Tarunjeet20 June 2021

This course exceeded my all expectations. This topic CQRS, event sourcing and SAGAS is pretty complex but Sergey made it pretty easy to understand. Love it and can't wait to get more courses like this from Sergey

Lalit19 June 2021

This course is an amazing in terms of covering most of the frameworks use in developing Microservices with detailed explanations. Tuned to go further and learn more !!!

Ravindra15 June 2021

I don't see any usefulness in this course the concepts totally irrelevant whoever want to learn microservices

Md13 June 2021

Great course. Covers a lot of important concepts on the subject matter with intuitive examples. I have learned valuable lessons from this course. Lectures are clear and easy to understand. A couple of minor things that I wish could have been made better: i) For complex patterns, an architectural / flow diagram could be shown (more) frequently ii) A lot of lectures felt too short to such an extent that it felt like unnecessary interruptions; specially when watching on mobile, loading of a new lecture causes noticeable pause every time iii) Starting of discovery server, services, API gateway etc would have been sufficient to show once or twice initially and then skipped during the rest of the course. I felt it was somewhat unnecessary to demonstrate that every time. Overall, I would highly recommend this course. Thanks Sergey!

Javier30 May 2021

A good course to learn the basics (although a bit more theory about each topic would be welcomed). The major flaw I noticed is that assignment solutions (like OrdersService) do not correspond exactly with the code shown in the lessons following. Even when these differences are not significant (redundancies, wrong access modifiers, etc.), their presence can confuse the student sometimes and they make the course content look worse than it really is.

Partha29 May 2021

The course is excellent and I was searching similar course and now found it. It meets and exceeds my expectation.

Anuj27 May 2021

This course is really good to learn event based microservices. The trainer is really good and has covered all scenarios in detail. Thanks

Manisankar27 May 2021

Excellent course. Sharp, Short, in-depth. Including how to deploy this whole structure in cloud like AWS and how to containerize and orchestrate those using kubernetes would have been great. Recommended

Bidyadhar22 May 2021

It's an Excellent course. I never seen any instructor gone step by step to explain all complex concepts easily. Kudos to the instructor.

Jeffrey22 May 2021

It has been a very good match! Sergey is explaining the architecture and underlying details very well and very clearly.

Bipin18 May 2021

Code is easy to understand and instructor explain all the aspect of CQRS and SAGA using axon framework nicely. Some topic like use of event store other than axon , using different command source other than Axon framework is missing. I hope in future it will be added.

Yohanes9 May 2021

Awesome Course, I'll wait for next level course about Microservice CQRS, maybe with end to end example

Akshat1 May 2021

Thank you Sergey, for another course. I actually amazed that how exactly you knew about what I have been looking for :-) This is my 3rd learning with you and again, I have got exactly what I was looking for. Special thanks for the discount coupon.

sameer30 April 2021

Sergey, Take a Bow. This is am amazing course. Even though i have got 4 years of experience in developing microservices in java technologies, i have never come across a course like this. This one course is enough to become an accomplished microservices architect and developer. The pacing is extremely good and complex topics have been made very easy to understand. Highly recommended.


Udemy ID


Course created date


Course Indexed date
Course Submitted by