Closed sridhar1982 closed 9 years ago
Why @EnableZuulProxy is missing in api-gateway-microservice. Isn't this service acts as gateway for other services?
The API gateway service can use either @EnableZuulProxy
or @EnableZuulServer
.
Using the @EnableZuulServer
annotation you must explicitly configure proxying behavior to other applications. By using the @EnableZuulProxy
annotation you are getting the benefit of automated discovery of Zuul filters through Eureka. This automatic routing is provided by Ribbon. Ribbon will contact Eureka and route requests to the services that correspond to the configured filter.
http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html#_plain_embedded_zuul
From the docs:
You can also run a Zuul server without the proxying, or switch on parts of the proxying platform selectively, if you use @EnableZuulServer (instead of @EnableZuulProxy). Any beans that you add to the application of type ZuulFilter will be installed automatically, as they are with @EnableZuulProxy, but without any of the proxy filters being added automatically.
These annotations should not be used together.
What is the use of @EnableSidecar. It sounds like a new annotations who functionality is not defined. can you please explain its use?
Sidecar allows non-JVM apps (like Node.js) to be proxied through Zuul server. I have plans to use it in a later revision.
http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html#_polyglot_support_with_sidecar
Why @EnableZuulProxy is present in user-microservice. Isn't this a standalone service and does not act as gateway or proxy?
By adding this annotation in combination with the gateway service's sidecar annotation, I can inject this service's filters as routes to any service that has the @EnableZuulProxy
annotation and is configured for discovery to Eureka. This is convenient for scenarios where you want each REST API instance to have a catalog of all other REST APIs exposed by services in the architecture.
do you have example of last case you described? (the last paragraph in yours)
Hi, Thanks for the great material here. I have a few questions here.
1) why
@EnableZuulProxy
is missing inapi-gateway-microservice
. Isn't this service acts as gateway for other services?2) what is the use of
@EnableSidecar
. It sounds like a new annotations who functionality is not defined. can you please explain its use?3) why
@EnableZuulProxy
is present inuser-microservice
. Isn't this a standalone service and does not act as gateway or proxy?Thanks