In your opinion, in a hybrid architecture (WEBSOCKET + HTTP) is it good practice to use 2 gateways: Zuul for HTTP communication and Spring Cloud Gateway for WEBSOCKET communication in a Spring Boot application? Alternatively, in this scenario is it recommended to use only Spring Cloud Gateway?
Thanks.
is it recommended to use only Spring Cloud Gateway Yes because
Spring Cloud does not provide any out of the box integration with Zuul2. Gateway has many features that are not available in the public version of Zuul2 such as Rate limiting, etc. Also, with the gateway you can have custom filters defined per route and there are tons of built-in filters defined as well, which helps a lot to get started. Reference
Reference: I think SCG is the way to go due to the agreements between Netflix and Pivotal, with the former leaning more toward the spring boot/cloud ecosystem as stated in https://medium.com/netflix-techblog/netflix-oss-and-spring-boot-coming-full-circle-4855947713a0
Related
I'm implementing a microservices system with Spring Boot, and I want to have a service that using Rsocket to make real-time connecting between user and system. But in the document of Spring Cloud Gateway, that's seem not support Rsocket. Is this possible to using Rsocket in a microservices system with Spring Boot ? Or should I using websocket instead ?
Here is my idea
Don't try this, lost time. See authoritative article
https://spring.io/blog/2020/03/25/spring-tips-spring-cloud-loadbalancer
https://spring.io/guides/gs/spring-cloud-loadbalancer/
https://cloud.spring.io/spring-cloud-gateway/reference/html/#the-websocket-routing-filter
https://cloud.spring.io/spring-cloud-gateway/reference/html/#the-loadbalancerclient-filter
https://cloud.spring.io/spring-cloud-gateway/reference/html/#reactive-loadbalancer-client-filter
For load balancing with Spring Cloud Gateway, let use technology stack [Eureka Discovery Client + Cloud Loadbalancer + Reactive Web] or Ribbon (Netflix Open Source Software - Netflix OSS).
Rsocket for "... Reactive Streams", load balancing need something like request/response round robin, these are different.
Does Spring Cloud Function provide some kind of functionality similar to Spring Security Filter Chains ?
One particular use case is to implement CORS with AWS Lambda API Gateway in proxy integration mode. According to the AWS docs, it's function responsibility to add CORS headers to the response.
It might be more useful to do this at the integration layer and not in the business logic.
I'm using Spring Cloud Function with AWS adapter and Spring Boot.
I've browsed through the code (3.1.3 at the time of writing) but didn't find something alike.
There's one old issue showing CorsFilter registration (with Azure provider) but I doubt it really worked as Spring Cloud Function does not utilize Servlet environment.
I want to use Spring Cloud Gateway with SAML. Is this possible?
It seems that the Saml extension for spring security is based on the old Spring Stack and won't work with Gateway.
Has anybody got any experience on this?
I'm afraid SAML is not supported as of time of writing. Spring Cloud Gateway has been redeveloped using Reactive programming and is now based on Spring WebFlux. Only the following authentication methods are currently supported :
OAuth 2.0 or OpenID Connect 1.0
x509 authentication
This is stated on SCG page:
Spring Cloud Gateway is built on Spring Boot 2.x, Spring WebFlux, and
Project Reactor. As a consequence, many of the familiar synchronous
libraries (Spring Data and Spring Security, for example) and patterns
you know may not apply when you use Spring Cloud Gateway. If you are
unfamiliar with these projects, we suggest you begin by reading their
documentation to familiarize yourself with some of the new concepts
before working with Spring Cloud Gateway.
The previous gateway spring-cloud-netflix-zuul, based on Servlets and which supported SAML, has been removed from Spring Cloud 2020.
Here is an open issue on GitHub, SAML2 for reactive environment, where we can vote for asking for this to be implemented.
I search to use spring boot, spring-cloud-gateway, netflix eureka.
Is there anything to do to have a load balancer and circuit breaker for micro-service instance?
I found few information ex ribbon when spring gateway is used instead of zuul.
Actually I have an application for the gateway, another for eureka, another for thymeleaf client
security is not yet choose, probabley jwt
With Spring Cloud Gateway, you can currently use the Hystrix Gateway Filter.
Consider using Hystrix. It is extremely good for microservices and aligns well with Spring cloud stack. Also, take a look at Feign, due to its simplistic approach to communication between microservices and integration with hystrix and ribbon.
I'm pretty much new to spring cloud gateway. I have configured routing with two different apps with 'path'. Now, I need some help/docs on
1. How to route to different instance of an app from spring cloud gateway?
2. How to enable sticky session?
My apps are not using spring boot/eureka. I do see that I can use lb://service-name if i'm using any discovery client (unfortunately that is not my case).
Thanks in advance.
IMHO:
How to route to different instance of an app from spring cloud gateway?
Routing to different instances is the basic job of what spring cloud gateway is doing. Spring cloud gateway implements the pattern named client side routing along with the ease of service discovery. So if you are not using any discovery server or your apps are not registered with any discovery server, you loose the dynamic discovery and routing feature, BUT still you can specify your server list (refer to Netflix Ribbon). Until then you can think about your routing strategy.
How to enable sticky session?
I suppose that's one requirement of your routing strategy - implement sticky session because you are not using shared session store. According to my limited knowledge of spring cloud gateway, sticky seems not being supported out of box. But it could be customized with a Filter, see shipped LoadBalancerClientFilter for reference.
Good luck!