Learnitweb

Category: Microservices with Spring

  • Implementing Cross Cutting Concerns – Tracing and Logging Using Gateway

    Cross-cutting concerns such as logging and tracing are crucial in microservices architectures to ensure observability and maintainability. Implementing these concerns at the gateway level allows uniform handling of requests and responses before they reach backend services. Implementation We’ll create a package com.learnitweb.gatewayserver.filters and add following classes: FilterUtility.java Key functions: RequestTraceFilter.java ResponseTraceFilter.java The ResponseTraceFilter is a…

  • Implementing Custom Routing Using Spring Cloud Gateway

    Spring Cloud Gateway provides developers with the flexibility to customize and define their own routing configurations. In this tutorial, we’ll see how to do that. Configuring RouteLocator Now, let’s define a custom routing configuration using RouteLocator in a Spring Boot application. Create RouterLocator bean in the application. Explanation of the code Example Routing Behavior Incoming…

  • Building Edge Server using Spring Cloud Gateway

    In this tutorial, we’ll build an edge server using Spring Cloud Gateway. Dependency To create an edge server using Spring Cloud Gateway, following is the dependency: We’ll also need the spring-cloud-starter-netflix-eureka-client dependency as our gateway server is going to register with Eureka server. Following is our complete pom.xml: Configuration Following is the complete configuration file…

  • Why Do We Need a Gateway in a Microservices Application?

    1. Introduction Microservices architecture has become a popular design choice for building scalable, flexible, and maintainable applications. Instead of a monolithic structure, applications are divided into smaller, independent services, each responsible for a specific business functionality. While this approach has many benefits, it also introduces challenges, particularly in managing communication, security, and monitoring across services.…

  • Eureka self-preservation mode

    1. Introduction Eureka’s self-preservation mode is a built-in feature that helps prevent instances from being prematurely removed from the Eureka registry during transient network issues. This mode is triggered when Eureka detects that it has lost connection with a significant portion of its registered instances or clients. 2. What is Self-Preservation Mode? 3. Enabling/Disabling Self-Preservation…

  • Spring Cloud OpenFeign

    1. Introduction In this tutorial, we’ll discuss Spring Cloud OpenFeign. This tutorial is a summary from documentation page of Spring Cloud OpenFeign. Spring Cloud OpenFeign project provides OpenFeign integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. 2. Declarative REST Client: Feign Feign is a…

  • Invoke other microservice using Feign client

    1. Introduction In this tutorial, we’ll create use microservices – product and inventory. These microservices will be registered with a Eureka server. We’ll then call an endpoint of product microservice and this will call the inventory microservice. 2. Inventory microservice In our previous tutorials, we used product microservice. The inventory microservice is similar to that…

  • Spring Cloud Netflix

    1. Introduction Spring Cloud Netflix provides Netflix OSS integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment. By using a few straightforward annotations, you can easily activate and configure common patterns within your application, enabling you to build robust distributed systems powered by reliable Netflix components. These patterns include Service Discovery…

  • Setup Service Discovery using Eureka server

    1. Introduction In this tutorial we’ll discuss how to implement client side service discovery. Spring Cloud project makes Service Discovery setup is very easy with the help of following components: 2. Setup Eureka server Following is the main dependency we need to add for eureka server. Here is the complete pom.xml: Add @EnableEurekaServer annotation to…

  • Introduction to Service Discovery and Service Registration in microservices

    1. Introduction In this tutorial, we’ll discuss why we need service discovery and service registration in microservices. Let us first understand the problem which service discovery and service registration tries to solve. Suppose we have three microservices: ‘Product’, ‘Order’ and ‘Delivery’. These microservices handle storing, fetching, and processing data, executing business logic, and responding to…