Category: microservices
-
How to create HTTP/REST APIs using AWS Serverless framework?
HTTP/REST APIs have become the defacto standard of communication between most web applications. You can create an API and deploy it on a server or on the cloud or go serverless . To go serverless you can use a tool like AWS lambda. And to ease the development and deployment of AWS lambda you can…
-
How to implement Event Sourcing in Spring Boot?
All our web applications deal with data. We store this data mostly in a database. The data which is stored thus represents the current state of the data. For example , if you have a Customer table the table will have entries which represent the current state of the customer (what their name is and…
-
How to implement Transactional Outbox design pattern in Spring Boot Microservices?
Let’s say you have created a microservice. One of the APIs in the microservice does two operations: How can you make sure both are transactional? In other words if database update fails don’t send the message to the other service and if message sending fails rollback the database update? In Spring you handle transactions using…
-
How to implement distributed tracing using Spring Cloud Sleuth in Spring Boot?
Microservices comes with many advantages. But there are disadvantages too. One of them is tracing the logs of your microservices. When there are so many microservices , user requests will span many of them and it will be difficult to trace the logs for a particular request when an issue occurs. To resolve this you…
-
How to do server side load balancing using Spring Cloud Gateway and Netflix Eureka?
In this post we saw how to do client side load balancing in Spring Boot Microservices. One disadvantage of client side load balancing is every microservice client need to implement this load balancing. This might not be a big deal given how simple the changes required are. Still there is some coupling on the client…
-
How to do client side load balancing in Spring Boot?
Let’s say you have created a set of microservices. They communicate to each other through a service registry like Eureka. One shortcoming in communicating through service registry is load balancing is not taken care of by default. You need to take care of that through a client side load balancer or a service side load…
-
How to invoke OAuth2 protected microservice using WebClient in Spring Boot?
Let’s say you want to call an OAuth2 protected microservice from your Spring Boot microservice application. Spring Boot as usual does majority of the work for us. We just need to add a dependency ,some configuration and using a single HTTP call using Spring Web Client we can invoke the microservice. Before that , to…
-
How to protect your Spring Boot microservice with OAuth2?
Protecting your microservice developed in Spring Boot is quite forward. Spring does all the major work for you. Here are the steps to follow: STEP 1: Add spring boot starter oauth2 resource server dependency STEP 2: Configure Authorization Server STEP 3: Test STEP 1: Add spring boot starter oauth2 resource server dependency Add the below…
-
How to set up KeyCloak for OAuth2 client credentials flow?
We live in the age of microservices. Microservices are often deployed as REST APIs. And the most popular way to protect and access these REST APIs is through OAuth2 protocol. And in OAuth2 protocol ,the preferred way to protect REST APIs is through client credentials. To set this, You first need an Identity and Access…