Eugene Shmorgun
Eugene Shmorgun

Reputation: 2075

Spring Cloud: How to manage requests on Zuul to another services?

Actually I would like to understand correct approach for managing requests among several microservices, one of them is Zuul:

  1. I have Zuul-app, which is proxy before my microservice. Zuul started on port 7777 and declares API like /api/service1/get or /api/service2/get. On every service I have echo-endpoint which is available localhost:7777/api/service1/get and work well.
  2. But those echo-endpoints are available directly from corresponding services. Thus I can make request from Postman, let's say, to service1/get/ and service2/get

As far as I understand anybody can call those services through Zuul or directly from those services. So what is difference and what is real value of Zuul for such case (instead of Zuul can authorize users, let's say as proxy microservice)

So what is correct approach for using Zuul for microservices ?

Upvotes: 0

Views: 459

Answers (1)

Milenko Jevremovic
Milenko Jevremovic

Reputation: 1056

Your question looks like you are asking two things. What is the purpose and how to use it. Going to answer the first one.

Its purpose is to be the service in front of all the other services you have. Like front door to your system. Rest of the services should be hidden of outside world, behind proxy service.

The purpose is to route all the services from one place, so with netflix-zuul you are able to intercept the request, manipulate, authenticate, route...

You can integrate service discovery (netflix-eureka) so your services will be registered there, and you don't need to deal with urls of your services, you can access them by path you defined and registered service ids.

You can integrate load balancing (netflix-ribbon) across your system.

You can control the interactions between your services by adding latency tolerance and fault tolerance logic (netflix-hystrix). So you can provide fallback options when error occurs..

And so on...

Upvotes: 1

Related Questions