Distributed tracing helps you follow a request as it flows through multiple microservices. It’s useful for: Debugging latency issues Understanding service dependencies Observing bottlenecks in request paths Traces are usually composed of spans: Trace ID: identifies the full request flow. Span ID: identifies a single operation within the trace. Parent Span ID: connects spans…
Spring Cloud Task
2. What is Spring Cloud Task? Spring Cloud Task is a microservice framework for creating short-lived, one-time tasks in a Spring Cloud environment. Unlike long-running services, tasks start, run, and finish. Typical use cases: Batch jobs Data migration scripts Event-driven tasks triggered by an event or schedule Key points: Each task is short-lived Can…
Spring Cloud Data Flow
2. Spring Cloud Data Flow Overview Spring Cloud Data Flow (SCDF) is a microservices-based orchestration service for data integration and real-time data processing. It allows you to: Deploy streaming and batch data pipelines. Compose microservices (sources → processors → sinks). Monitor and manage applications at runtime. Key concepts: Source: Produces data (e.g., HTTP, Kafka,…
Prometheus in Spring Boot
Prometheus is an open-source monitoring and alerting toolkit (part of the CNCF ecosystem). Supervision in this context usually refers to supervising processes or services using Prometheus. Prometheus collects metrics from services and systems, stores them, and lets you set up alerts (via Alertmanager) to supervise the health of your infrastructure. Example: CPU usage, memory…
RabbitMQ in Spring Boot
1. Prerequisites Java 17+ Spring Boot 3.x RabbitMQ (running locally or via Docker) For RabbitMQ Docker: docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management 5672 → RabbitMQ port 15672 → Management console 2. Add Dependencies In pom.xml (for Maven): <dependencies> <dependency> <groupId>org.springframework.boot</groupId>…
Kafka in Spring Boot
1. Prerequisites Java 17+ installed Spring Boot 3.x Kafka running locally or via Docker If you want a quick Kafka setup using Docker: docker run -d --name zookeeper -p 2181:2181 zookeeper:3.8 docker run -d --name kafka -p 9092:9092 --env KAFKA_ZOOKEEPER_CONNECT=host.docker.internal:2181 --env KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 bitnami/kafka:latest docker run -d --name zookeeper -p 2181:2181 zookeeper:3.8 docker run -d…
Eureka in Spring Boot
1. Setup Eureka Server Step 1: Create a Spring Boot Project Dependencies: Spring Web Eureka Server Step 2: pom.xml Example <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>2021.0.6</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency>…
Spring Cloud Gateway
1. What is Spring Cloud Gateway? Spring Cloud Gateway is a library that provides API gateway functionality. It allows you to: Route requests to different microservices Apply filters (like authentication, logging, rate limiting) Handle cross-cutting concerns in a microservice architecture It’s the modern alternative to Netflix Zuul. 2. Project Setup You can use Spring…
Spring Cloud Config
1. Spring Boot Overview Spring Boot is a framework that simplifies creating production-ready Spring applications. Key points: Provides embedded servers (Tomcat, Jetty), so you don’t need to deploy WAR files. Auto-configuration reduces boilerplate code. Supports microservices architecture. 2. Spring Cloud Config Overview Spring Cloud Config provides centralized configuration management for distributed systems. It allows…
Mockito in Spring Boot
1. Spring Boot Setup Suppose we have a simple app that manages users. User model: package com.example.demo.model; public class User { private Long id; private String name; // Constructors public User() {} public User(Long id, String name) { this.id = id; this.name = name; } // Getters & Setters public Long getId() { return…