One of the challenges in microservices architecture is the ability to debug issues. A simple user action might trigger a chain of downstream microservice calls. It would be tedious to trace the logs related to a particular user action across microservices. In addition to that, we might want to track down why a certain microservice call is taking so much time. We can use Spring Cloud Sleuth to handle these kinds of issues.
Continue reading »MicroServices - Part 5 : Spring Cloud Zuul Proxy as API Gateway
In microservices architecture, there could be a number of API services and few UI components that are talking to APIs. As of now, many microservices based application still use monolithic front-ends where the entire UI is built as a single module. You may choose to go with micro-frontends where the UI is also decomposed into multiple microservice talking to APIs to get the relevant data. Instead of letting UI know about all our microservices details we can provide a unified proxy interface that will delegate the calls to various microservices based on URL pattern.
Continue reading »MicroServices - Part 4 : Spring Cloud Circuit Breaker using Netflix Hystrix
In the microservices world, to fulfill a client request one microservice may need to talk to other microservices. We should minimize this kind of direct dependencies on other microservices but in some cases it is unavoidable. If a microservice is down or not functioning properly then the issue may cascade up to the upstream services. Netflix created Hystrix library implementing Circuit Breaker pattern to address these kinds of issues. We can use Spring Cloud Netflix Hystrix Circuit Breaker to protect microservices from cascading failures.
Continue reading »MicroServices - Part 3 : Spring Cloud Service Registry and Discovery
In the microservices world, Service Registry and Discovery plays an important role because we most likely run multiple instances of services and we need a mechanism to call other services without hardcoding their hostnames or port numbers. In addition to that, in Cloud environments service instances may come up and go down anytime. So we need some automatic service registration and discovery mechanism. Spring Cloud provides Service Registry and Discovery features, as usual, with multiple options.
Continue reading »MicroServices - Part 2 : Configuration Management with Spring Cloud Config and Vault
In MicroServices using Spring Boot & Spring Cloud – Part 1 : Overview, we took a brief look at what are micro-services and how we can use SpringBoot and SpringCloud to build micro-services. In this post, we are going to learn: What is the need for Spring Cloud Config and Vault? Create our first micro-service: catalog-service Create Spring Cloud Config Server Using Vault for storing sensitive data MicroServices using Spring Boot & Spring Cloud
Continue reading »MicroServices using Spring Boot & Spring Cloud – Part 1 : Overview
Nowadays MicroServices is the hot buzzword in software development and many organizations prefer building their enterprise applications using MicroServices architecture. In Java community, SpringBoot is the most widely used framework for building both monoliths and microservices. I am planning to write a series of articles covering how to build microservices using SpringBoot and SpringCloud. In this article we are going to learn about following: Monoliths what are MicroServices? Advantages of MicroServices Challenges with MicroServices Why SpringBoot & SpringCloud are a good choice for MicroServices?
Continue reading »Spring Cloud Tutorials – Auto Refresh Config Changes using Spring Cloud Bus
Problem In the previous article Introduction to Spring Cloud Config Server we have seen how to use Spring Cloud Config Server. But, the problem is to reload the config changes in Config Client applications we need to trigger /refresh endpoint manually. This is not practical and viable if you have large number of applications. Solution Spring Cloud Bus module can be used to link multiple applications with a message broker and we can broadcast configuration changes.
Continue reading »Spring Cloud Tutorials – Introduction to Spring Cloud Config Server
Problem SpringBoot provides lot of flexibility in externalizing configuration properties via properties or YAML files. We can also configure properties for each environment (dev, qa, prod etc) separately using profile specific configuration files such as application.properties, application-dev.properties, application-prod.properties etc. But once the application is started we can not update the properties at runtime. If we change the properties we need to restart the application to use the updated configuration properties.
Continue reading »