In this section you will learn how to build business logic that spans several distributed Spring Boot Microservices.
This section 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 section 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 section 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.
Microservice is the buzz word in today’s tech world.
If you can categorize, microservices can be divided into 2 types:
- Request/Command Driven Microservices
- Event Driven Microservices
1. Request/Command Driven Microservices:
Its is a normal RESTful webservice, which sends a GET,POST,DELETE,… etc requests and gets respective responses. Its is an synchronous form of service where the requester has to wait till the response is not delivered.
2. Event Driven Microservices:
This is also called as a Pub-Sub(Publisher-Subscriber) model. It is an asynchronous way of communicating where the Producer sends the message and does not wait for the Consumer to process it.
A broker is basically a Topic or a Queue.
The message that is published or consumed can be of these 3 types- Command, Query or Event.
Suppose Microservice B receives a message to do something, this will be called as a Command (just like POST call).
Then after some processing it may send some messages further down the stream, this will be called as Events.
A Query will be a softer version of Command where it will be seeking some data (just like GET call)