Spring Cloud Gateway Architecture

The main components of the spring cloud gateway are:

  1. Route: It is an important component in the spring cloud gateway. I consist of ID, destination URI, predicates, and filters.
  2. Predicates: It is the same as Java 8 function predicate. A Predicate simply evaluates the input against a condition defined by the Predicate and returns true if the condition is satisfied. Here the Predicate is used to match the HTTP requests. A route is matched if the Predicate returns true.
  3. Filter Chain: It is a series of filters applied to incoming requests and responses. It can be used for various purposes like authentication, requests or response transformation, and many more.

Spring Cloud Gateway Architecture

The process begins with the client sending a request to the API gateway. The request first goes to the Gateway mapping handler. It uses Predicate to check whether a request matches a route. The request is then transferred to Gateway Web Handler. It passes the request through the Filter Chain specific to the request. Here the filters can be considered in two categories. When requests arrive all the pre-filter logic is executed. After the request is made all the post-filter logic is executed.

Spring Cloud Gateway

If you are aware of a microservices architecture, then there we have several spring boot applications (microservices) running on different ports or routes. An API gateway acts as a single point of entry for a collection of microservices. In simple words, all microservices can be accessed through a single port or route. It is a non-blocking and reactive gateway that provides several features like routing, filtering, load balancing, circuit breaking, and more. In this article first, we’ll look at the spring cloud gateway architecture and then implement it.

Similar Reads

Spring Cloud Gateway Architecture

The main components of the spring cloud gateway are:...

Project Configuration

Each spring boot application that we’ll create will be the Maven project with the following configurations...