
Learn to build distributed microservices with CQRS and event sourcing, manage cross-service transactions using Saga and Axon, and deploy RESTful services with Spring Boot, Eureka, and API gateway.
Decompose a large app into loosely coupled, fine-grained web services, each handling a single capability. Enable independent deployment, scalability, and language-agnostic HTTP communication.
Explore how splitting a monolith into microservices enables database per service, api gateway routing, and Eureka-based service discovery. Learn to scale with multiple instances, centralized configuration, and patterns like CQRS.
Learn how event-driven microservices publish commands and events to a message broker, enabling asynchronous, scalable, loosely coupled systems. Handle events and work with queries.
Learn how acid transaction properties apply to monoliths and why distributed microservices require saga patterns, with choreography and orchestration approaches to maintain data consistency.
Explore choreography-based saga patterns where microservices publish and consume events to drive an order flow and apply compensating transactions in reverse order on failure.
Coordinate an orchestration-based saga with a saga orchestrator managing commands from reserving product in stock to processing payment and shipping, and handle compensating events on failure.
Explore how to build transactional microservices with event-driven frameworks like Eventuate and Axon, leveraging CQRS, sagas, event sourcing, and Spring Boot integration.
Explore the cqrs pattern, separating commands and queries within microservices, where commands trigger writes via http post/put/delete/patch and queries read via http get using messaging and events.
Explore event sourcing within a CQRS architecture powered by Axon Framework. Persist every change as events in an event store, replaying them to reconstruct state and update the read database.
Axon Framework for distributed systems, covering event sourcing, command and query architecture, event stores, Axon Server management, and storage options like PostgreSQL, MySQL, or MongoDB.
Axon Console offers a friendly web interface to view metrics from Axon Server, inspect processors, aggregates, and handlers, and visualize message flows; optional but helpful for monitoring microservices.
Learn to download and install Docker Desktop on Mac or Windows, launch it, grant permissions, and verify with docker --version; explore uninstall options.
Download, install, and launch Sprint Tool Suite for Eclipse on macOS to run Java and springboard applications, with options like Net Bean's, IntelliJ, or Visual Studio Code.
Learn how to download, install, and launch the Postman HTTP client, then create and send your first HTTP request and inspect the HTTP response.
Create your first Spring Boot microservice using Spring Initializr and Maven, then configure group and artifact, add Spring Web and Lombok, and import the product service into your IDE.
Create a rest controller class annotated to handle http requests. Map the /products endpoint and ensure Spring scans the main root package and subpackages.
Build a rest controller to handle http post, get, put, and delete requests for a product in a microservice, returning simple strings.
Start a Spring Boot microservice, launch the app, and verify a RestController responds to http methods by sending post, get, put, and delete requests with handled responses.
Learn how Eureka discovery service helps microservices find each other by registering instances, enabling dynamic scaling with an API gateway and load balancer.
Create a new springboard project named discovery server in Sprint Tool Suite. Add the Eureka server dependency to make it a standalone Eureka discovery server, with group ID com.appsdeveloperblog.estore.
Configure the project as a Eureka server by adding the EnableEurekaServer annotation above the main class, set port 8761, disable registry fetch and registration, and access the dashboard at localhost:8761.
Register the product microservice as a Eureka client to become discoverable by the api gateway. Enable discovery with Spring Cloud Netflix Eureka using EnableDiscoveryClient and set server url and products-service.
Start the Eureka discovery server and run the products microservice, then verify registration in the Eureka dashboard. Observe the products service registers at port 8080 and exposes a /products endpoint.
Explore how Spring Cloud API Gateway routes HTTP requests to microservices via Eureka, balances load across instances, and uses custom filters to validate tokens and modify requests.
Enable automatic routing with the discovery locator in spring cloud gateway to auto map requests to registered microservices via Eureka, then adjust to lowercase service ids for reliable routing.
Start multiple Spring Boot microservice instances by assigning unique ports or using port zero for automatic selection, enabling discovery and load balancing through the API gateway.
Learn how to run multiple Spring Boot product microservice instances on random ports and register them with Eureka, using unique instance IDs, and verify via the Eureka dashboard.
Learn how spring cloud api gateway uses the ribbon load balancer to evenly balance http requests across two product service instances, and reveal the actual port with the environment's local.server.port.
download and run axon server as a standalone jar or via docker, then access the management dashboard on port 8024 and initialize in standalone mode.
Learn to configure Axon Server with properties files, using the axoniq.axonserver prefix for most settings, set server.port and hostname, enable dev mode, and start the server to view the dashboard.
Run Axon server in a docker container using docker run, publish ports, and mount external volumes for data, event data, and config. Docker will pull Axon server image if needed.
Learn how to manage Axon server in docker: start, stop, delete containers by id, use docker ps and docker start/stop/rm, and run a new container when needed.
Copy the axon server properties file into docker-data/config, configure ports 80 and 24, enable development mode, and verify via axon server dashboard that the server name and settings are correct.
Learn how Spring converts JSON payloads in HTTP post requests into a Java object via a create product rest model using @RequestBody.
Boot the Eureka service, start the products microservice, and start up API gate to post a json payload; Postman shows the http post handled and the product title appended.
Locate the Axon spring boot starter in the maven repository, then copy the XML dependency. Paste it into pom.xml after project lombok, then format and save to complete the setup.
Create product command class in the command package with fields from the rest model and a product ID annotated as target aggregate identifier, using data annotations.
Create a CreateProductCommand using the builder, populate price, quantity, title, and a generated UUID for the product ID, build the command, and send it to the command bus.
Inject the Command Gateway into the controller via constructor-based dependency injection to send the create product command to the Command Bus, where commands dispatch to a single handler.
Define the product aggregate as the heart of the products microservice, holding product state (title, price, quantity) and handling create commands with validation, while using event sourcing to rebuild state.
Create a product aggregate class annotated with the aggregate annotation, and add a default constructor for Axon, plus a CreateProductCommand handler constructor to instantiate the aggregate on the first command.
Validate create product command in the aggregate class's command handler by adding validation checks for price and title, throwing a legal argument exception when invalid, and routing errors to controller.
Define a ProductCreatedEvent class with product id, title, price, and quantity, following simple past tense naming, to persist new product data and publish the event in the workflow.
Publish the product created event by creating the event instance and copying properties from create product command with BeanUtils copyProperties, then apply to dispatch the event and update aggregate state.
Learn how event sourcing handlers initialize and update a product aggregate in Axon. Use the @EventSourcingHandler annotation, aggregate identifiers, and the apply method to publish the product created event.
Add the Google Guava dependency to the product service pom.xml after the Axon Spring Boot Starter by selecting Guava from mvnrepository, copying the XML snippet, and updating the project.
Debug the end-to-end product creation flow from controller to command handler to event sourcing, validating the product created event (price, product ID, quantity, title) and the returned product ID.
Preview and locate a persistent event in the event store using the Axon server dashboard, enable live updates, and filter by time or aggregate identifier to inspect the XML payload.
Consume the product created event on the query side and persist product details into the read database using an event handler and the sprint data framework with the H3 database.
Add Spring Data JPA and H2 dependencies to the products microservice via pom.xml to enable database storage of product details, with Spring Boot managing versions.
Configure the product service to connect to an h2 database by updating application.properties with the jdbc url, username, password, driver class, dialect, and ddl-auto update, and enable the h2 console.
Create a product entity class as a JPA entity mapped to the products table, with fields productId, title, price, and quantity; implement serializable and use Lombok @Data with unique constraints.
Create a product repository interface extending JpaRepository to use Spring Data JPA for database access, with methods like findByProductId and findByProductIdOrTitle auto-implemented by Spring.
Create a product events handler (projection) to listen for ProductCreatedEvent and persist product details into the products database table, wiring it as a component in the query API.
Inject the products repository via constructor-based dependency injection, map a ProductCreatedEvent to a ProductEntity with BeanUtils, and save it using ProductRepository to persist product details.
Run and debug an event-driven microservices workflow to persist products. Observe the ProductCreatedEvent in the event handler and verify two records in the database via API gateway and Postman.
Configure the product service to enable the H2 console via application properties. Open the H2 console through the API gateway, log in, and preview product records with SQL queries.
Learn to query information from the read database by implementing a query side endpoint, rest controller, query bus, and query handler using spring data jpa repository.
Create a product query controller to handle http get requests, separating command and query into controllers and packages, annotated as rest controller with request mapping, returning a list of products.
Refactor the command api rest controller by organizing classes into command, core, and query packages, and rename the products controller to product command controller within the command rest package.
Add a GetProducts endpoint with GetMapping to return a list of ProductRestModel, built from ProductCreatedEvent fields, and route the query to a handler using the GPA repository.
Create a find product query and send it via the query gateway to the query bus. The query handler processes it and returns product rest models via a completable future.
Create a products query handler class, annotate it as a component, and inject the products repository via constructor. Implement a method to query the database and return list of products.
Implement a query handler findProducts that uses the repository.findAll() to fetch all products, converts entities to product rest models with beanutils, and returns the list.
Open the products command controller, comment out the http get method, start discovery server, product service, and api gateway, then test with postman to verify the query handler.
Validate incoming JSON or XML payloads at the start of the request flow. Use Hibernate Validator to enforce constraints on Java bean properties like title, price, and quantity.
Enable bean validation by adding Spring Boot starter validation to the product service, configure properties to always include messages and binding errors, and annotate beans with validation constraints.
Validate the request body JSON for product creation using bean validation annotations such as not blank and min and max, with @Valid triggering 400 bad request on errors.
Demonstrates request body validation in a microservices setup by posting to create product via Eureka and API gateway, triggering 400 errors for empty title and invalid quantity, then an entry.
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.