Kafka Tutorial - Producer and Consumer using SpringBoot

In the previous post Kafka Tutorial - Java Producer and Consumer we have learned how to implement a Producer and Consumer for a Kafka topic using plain Java Client API. In this post we are going to look at how to use Spring for Kafka which provides high level abstraction over Kafka Java Client API to make it easier to work with Kafka. You can find the source code for this article at https://github.

Continue reading »

Kafka Tutorial - Java Producer and Consumer

Kafka, depending on how you use it, can be seen as a Message Broker, Event Store or a Streaming Platform etc. Kafka became a preferred technology for many of the modern applications because of various reasons like: Kafka can be used as an Event Store if you are using Event Driven Microservices architecture Kafka can be used as a Message Broker to enable communication across multiple applications Kafka can be used as Streaming platform for processing events in realtime etc etc.

Continue reading »

SpringBoot Best Practices

I have been working with SpringBoot for many years and over the time I worked with many SpringBoot based codebases. There are few common mistakes that I observe in the projects that use SpringBoot. So, I thought of writing down few good practices that can be followed while using SpringBoot. 1. Understand SpringBoot Core Concepts I know, this sounds very obvious but I see many developers jumping onto using SpringBoot without having any prior knowledge on Spring, Dependency Injection.

Continue reading »

MicroServices - Part 6 : Distributed Tracing with Spring Cloud Sleuth and Zipkin

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 »

Why SpringBoot is so popular and how to learn SpringBoot effectively?

SpringBoot is the most popular and widely used Java framework. Occasionally this discussion of “Why is SpringBoot so popular?” come between me and my friends/colleagues. Also, I do get emails from various people asking “Spring is huge and how to learn it quickly?”. In this post, I will try to answer these 2 questions. Why is SpringBoot so popular? There could be many reasons why Spring and SpringBoot are very popular, but in my opinion following are the key reasons:

Continue reading »