Docker Compose – Dockerizing Spring Boot Microservices MySQL App

Introduction Here I am going to show you how to use docker compose for dockerizing Spring Boot Microservices MySQL app. Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. You know that it is a best practice for a container to have only one process with single responsibility. But as I am going to dockerize Spring Boot Microservices app and MySQL…

Continue

How to Trace Microservices Logs with Spring Cloud Sleuth and Zipkin

Introduction Here I am going to explain how to trace Spring Boot Microservices logs with Spring Cloud Sleuth and Zipkin Server. Spring Cloud Sleuth provides Spring Boot auto-configuration for distributed tracing. One of the problems most developers face difficulty of tracing logs as your microservices applications grow and requests propagate from one microservice to another microservice. So it could be quite part to try to figure out how a particular request travels through the application when you don’t have any idea regarding the implementation of microservices you are calling.

Continue

How to implement Circuit Breaker Pattern using Hystrix in Spring Cloud Gateway

Introduction We will see how to implement circuit breaker pattern using Hystrix in Spring Cloud Gateway. Hystrix is a library from Netflix that implements the circuit breaker pattern. The Hystrix GatewayFilter allows us to introduce circuit breakers to our gateway routes, protecting our services from cascading failures and allowing us to provide fallback responses in the event of downstream failures. To enable Hystrix GatewayFilters in our project, we need to add a dependency on spring-cloud-starter-netflix-hystrix from Spring Cloud Netflix.

Continue

Use load balancer name for Microservices instead of host, port for URI in Spring Cloud Gateway

Introduction Here we will see how to use load balancer name or service name for Microservices instead of host, port for URI while building API gateway using Spring Cloud Gateway – the tutorial example which we have created earlier. We will use the same tutorial to use load balancer name instead of URL, such as, http://localhost:9000, http://localhost:9001, etc. for the URI value in application.yml configuration file. The advantage of using the load balancer name is you don’t need to worry about the change of the internal URLs for the microservices.…

Continue

How to build Spring Cloud Gateway for Microservices

In this tutorial we will build Spring Cloud Gateway for Microservices built using Spring Boot framework. Spring Cloud Gateway aims to provide a simple, yet effective way to route to APIs and provide cross cutting concerns to them such as: security, monitoring/metrics, and resiliency. Spring Cloud Gateway aims to provide a simple, yet effective way to route to APIs. When it receives request, Spring Cloud Gateway forwards it to a Gateway Handler Mapping, which determines what should be done with requests matching a specific route.

Continue

What is Orchestration and Choreography in micro-services ?

Orchestration is the automated configuration, coordination, and management of computer systems and software. Application or service orchestration is the process of integrating two or more applications and/or services together to automate a process, or synchronize data in real-time. In Orchestration, we rely on a central system to control and call other Microservices in a certain fashion to complete a given task. The central system maintains the state of each step and sequence of the overall workflow. Let’s say we want to develop a microservice that will send email about product…

Continue

Event Driven Streaming using Spring Cloud Stream and Apache Kafka

In this tutorial we will see an example of event driven streaming using Spring Cloud Stream and Apache Kafka streaming platform. How do we deal with some events, such as, a new user has registered to a portal, an order was placed, a file has been uploaded etc? Let’s say when an order was placed then we need a call to process payment, a call to reserve inventory, a call to begin the process of packaging, picking and shipping the product. For a few orders it’s not a big deal…

Continue

Spring MongoDB Functional Reactive Microservices Example

Introduction In this three pages post we will see how to create Spring MongoDB Functional Reactive Microservices Example. We are going to use here Spring 5’s Webflux API. We will also see here how to use Flux and Mono with ServerResponse, ServerRequest in Handler function. We will know how to use RequestPredicates in Router function in subsequent sections. We will use Spring Cloud, Eureka server and Ribbon for implementing our example. If you want to know about reactive or functional reactive programming then you need to go through Spring Boot…

Continue

Create Microservices using Spring Boot and build using Gradle

Introduction Here we will see how to create Microservices using Spring Boot and Spring Cloud and build using Gradle tool. What are Microservices? Before I tell you about the microservices, I would like to tell you about monolithic architectural style, which is built as a single, autonomous unit. So let’s say an web application with client-server model, where the server-side application is a monolith application that handles request/response, executes business logic and work with the data in the underlying database.

Continue

What is the use of Eureka server in Microservices

Here I will explain what is Eureka Server and why do we need to use Eureka server in Microservices Architecture? What is Eureka server? The Eureka server is nothing but an implementation of service discovery pattern, where microservices can register themselves so others can discover them. This server holds information about the client service applications. Each microservice registers into Eureka server and eureka server knows all client applications running on each port and IP address. This server is also known as discovery server. The @EnableEurekaServer annotation is used to make…

Continue