Mastering Spring Cloud
上QQ阅读APP看书,第一时间看更新

Routing with Zuul

The next popular pattern available under the Spring Cloud Netflix project is intelligent routing with Zuul. It is not only a JVM-based router but it also acts as a server-side load balancer and/or performs some filtering. It can also have a wide variety of applications. Netflix uses it for cases such as authentication, load shedding, static response handling, or stress testing. It is the same as Eureka Server in that it can be configured and run as an independent Spring Boot application. 

To include Zuul in your project use the spring-cloud-starter-zuul starter. In the microservices architecture, Zuul has a vital role of the API gateway, which is an entry point to the whole system. It needs to have knowledge of the network location of each service, so it is able to interact with the Eureka Server by including the discovery client to the classpath.