Zuul

From Chorke Wiki
Jump to navigation Jump to search
spring:
  application:
    name: ZuulProxy
zuul:
  sensitiveHeaders: Cookie,Set-Cookie
  routes:
    api:
      path: /api/self/rest/**
      url: https://localhost:2013/ebis/api/self/rest
    static:
      path: /**
      url: https://localhost:2015/
server:
  port: 1983
eureka:
  client:
    registerWithEureka: false

Conceptual

Zuul is an API Gateway or an Edge Server developed by Netflix. It is capable of performing the below tasks.

  1. Authentication and Security: Identifying authentication requirements for each resource and rejecting requests that do not satisfy them.
  2. Insights and Monitoring: Tracking meaningful data and statistics at the edge in order to give us an accurate view of production.
  3. Dynamic Routing: Dynamically routing requests to different backend clusters as needed.
  4. Stress Testing: Gradually increasing the traffic to a cluster in order to gauge performance.
  5. Load Shedding: Allocating capacity for each type of request and dropping requests that go over the limit.
  6. Static Response Handling: Building some responses directly at the edge instead of forwarding them to an internal cluster.

Filters

Filters are a way of extending Zuul’s default functionality and adding your own custom features. Filters can be divided into four types based on the stage that they are executed in, during the request routing process.

  1. pre Filters run before the request is routed.
  2. route Filters can handle the actual routing of the request.
  3. post Filters run after the request has been routed.
  4. error Filters run if an error occurs in the course of handling the request.

Netflix Eureka

Lookup for Version
https://www.baeldung.com/spring-cloud-netflix-eureka
https://github.com/eugenp/tutorials/tree/master/spring-cloud/spring-cloud-eureka

Lookup for Dependency
https://github.com/eugenp/tutorials/blob/master/parent-boot-2/pom.xml
https://github.com/eugenp/tutorials/blob/master/spring-cloud/pom.xml
https://github.com/eugenp/tutorials/blob/master/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml
<version.chorke.spring.cloud>2021.0.0</version.chorke.spring.cloud>
<version.chorke.spring.boot>2.6.3</version.chorke.spring.boot>

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-dependencies</artifactId>
    <version>${version.chorke.spring.cloud}</version>
    <scope>import</scope>
    <type>pom</type>
</dependency>

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>

References