Microservice - Spring Cloud Zuul Reverse Proxy as Service Gateway

Continuing on, Zuul is a router and a server-side load balancer developed and popularized by Netflix. Zuul uses ribbon to call the remote se...


Continuing on, Zuul is a router and a server-side load balancer developed and popularized by Netflix. Zuul uses ribbon to call the remote services registered in a discovery server such as Eureka. By annotating a SpringBoot class with @EnableZuulProxy, a route is created for each service from the discovery client. As we add new services, routes are refreshed.

@EnableZuulProxy also enables 2 additional endpoints:
  • Routes - a get to this endpoint returns a list of map routes, to get more details, add the query param format=details
  • Filters - a get to this endpoint returns a map of Zuul filters
Creating a Zuul Enabled project
  1. Create a new SpringBoot and add the following dependencies
    1. spring-cloud-starter-netflix-zuul
    2. spring-cloud-starter-netflix-eureka-client - register this server to the service discovery
    3. spring-boot-starter-web and spring-boot-starter-actuator to expose server information
  2. Annotate the SpringBoot class with @EnableZuulProxy and @EnableDiscoveryClient.
  3. Configuration the application name, port, eureka instance and Zuul in the property file.
No change is needed in our catalog service.

Run the projects in the following order
  • Terawarehouse-config-server
  • Terawarehouse-service-discovery
  • Terawarehouse-load-balancer
  • Terawarehouse-catalog 
The following url should be accessible:
  • <network_ip>:8000/catalog/default</network_ip>
  • <network_ip>:8761</network_ip>
  • <network_ip>:8001/api/v1/categories</network_ip>
  • <network_ip>:8762/routes</network_ip>
  • <network_ip>:8762/filters</network_ip>
  • <network_ip>:8762/catalog/api/v1/categories</network_ip>
The last entry routes our request in the /catalog/** path to the catalog service without knowing it’s actual url and port. And that’s the beauty of Eureka with Zuul, it simplifies the adding of a new service. Take note that we can run more than 1 instance of each service without changing the configuration. And that is what we will try to do next.

And that concludes this video. I hope this information will be of use to you when you decided to develop your own project using the microservice architecture.

I would appreciate if you could subscribe to my channel to get notified when I upload the next video and that will validate that what I’m doing is helpful for others, which will definitely inspire me to share more technical videos.

COMMENTS

mas template
Name

amazon,1,angular,8,bigdata,2,business,1,course-spring,27,courses,6,database,4,docker,3,java,50,kafka,1,keycloak,4,microservices,5,mysql,1,neworking,1,nosql,2,php,1,pinned,2,react,3,server management,7,shared drive,1,spring,7,synology,1,troubleshooting,2,web,1,wordpress,1,
ltr
item
toztech: Microservice - Spring Cloud Zuul Reverse Proxy as Service Gateway
Microservice - Spring Cloud Zuul Reverse Proxy as Service Gateway
https://i.ytimg.com/vi/Ge4Ebjt45zI/0.jpg
https://i.ytimg.com/vi/Ge4Ebjt45zI/0.jpg
toztech
https://toztech.blogspot.com/2019/10/microservice-spring-cloud-zuul-reverse.html
https://toztech.blogspot.com/
https://toztech.blogspot.com/
https://toztech.blogspot.com/2019/10/microservice-spring-cloud-zuul-reverse.html
true
2554149350007112447
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content