How to setup Spring Cloud LoadBalancer with RestTemplate? - spring

Is there a way to setup the new Spring Cloud LoadBalancer to work with RestTemplate? The only tutorials I find are using Flux and Project Reactor for microservice communications.

Yes, there is. You can see this branch for a working demo.

Related

Can Spring Cloud Stream work with Spring Cloud Kubernetes?

I haven't seen any example of combining the two, even though it makes sense they'll work together (because of being both subprojects of Spring Cloud). I want to use Spring Cloud Stream (Reactive Processing) for reading from Kafka and writing to MongoDB with the Reactive Mongo driver. Can I use Spring Cloud Config and Spring Cloud Kubernetes for a remote git configuration server, even though the application is an event-driven application and not a requests-based API?
It's pretty unclear how to plug these Kubernetes and config projects into Spring Cloud Stream, and in general, it's unclear to me if all of the other Spring Cloud projects can work with Spring Cloud Stream reactively. For instance, I couldn't also find a reference for using Spring Cloud Sleuth & Zipkin with Spring Cloud Stream. Can someone make it clearer for me and reference code examples if exists?

How we can integrate Springboot 2.x with Zuul 2

We have a springboot application which is currently having gateway as Zuul 1. Our application is running in Springboot 2.0.0.M2. We are trying to upgrade our Zuul gateway to Zuul 2. We created a springboot application with Zuul 2 dependency and added webflux dependency to get Netty server. The server starts fine, but we are still unclear that how the springboot application will understand that this is a gateway and filters needs to be executed. Although we have created Routes filter, but the same is not getting invoked.
Thanks in advance,
Ron
if you go through the video "https://www.youtube.com/watch?v=9wocKqF15B8" at 18:00 from spring developers. They clearly stated that zuul2 is not going to be supported by the spring ecosystem. Also, the replacement of zuul2 (non-blocking calls) is a spring cloud gateway which is also non-blocking calls.

How connect Spring Cloud Gateway + Spring Cloud Security + Keycloak

He has been trying to connect s-c-gateway and s-c-security with Keycloak for a couple of days. I want the modules that are located behind the gateway not to have a keycloak configuration.
Is Spring Cloud Gateway not supported by Spring Cloud Security?
There's an issue on the spring cloud gateway github about this - a short summary is that there's currently no official support but I'd suggest reading the full github comments
You could use #EnableWebFluxSecurity in cloud gateway, since it's reactive project.
I know this is an old question with an answer but now it is possible and very common to integrate Spring cloud Gateway, Spring cloud Security and Keycloak. You can find a good tutorial here:
https://kunkkali.blogspot.com/2020/10/build-j2ee-micro-services-architecture.html
Source code: https://github.com/liqili/spring-microservice-oauth2-keycloak-starter

How to implement Zipkin in vert.x

I want to implement Zipkin and Sleuth on vert.x application. I have Zipkin server application with Spring Boot and Spring Boot Services and its okay. I have added dependencies and setup them in application.properties and its working good. But I have one vert.x application and I have found it difficult to implement the Zipkin there. I have searched but I did not found some good example on how to implement it on vert.x application. So, what I need to do to implement the Zipkin in the vert.x application?

Example for Spring Cloud Consul with Ribbon for client side load balancing

I see that spring-cloud-consul is live in spring.io [https://spring.io/blog/2015/05/27/spring-cloud-consul-1-0-0-m1-available-now] but I hardly see any reference examples.
I am mainly looking for Service Registration and Service Discovery with Consul and Ribbon as client side load balancer. Could someone give a sample application or an example to refer. I also checked in the git repository for spring-cloud-consul, didn't find any examples there[https://github.com/spring-cloud/spring-cloud-consul]
There is an example in the main repo, spring-cloud-consul-sample, that uses the LoadBalancerClient of which there is a ribbon implementation that will use consul to populate the server list.
I wasn't able to find much information about Consul and Ribbon, but I have found more information about Eueka (it's used by Netflix and it also does service registration/distcovery similiar to Consul). This Spring project seems to be a lot more active. Info about it can be found here: http://cloud.spring.io/spring-cloud-netflix/
This blog post demonstrates how to use spring cloud with Eueka and Ribbon: https://spring.io/blog/2015/07/14/microservices-with-spring
There is also a repo for the tutorial: https://github.com/paulc4/microservices-demo
If you still want to use Consul instead of Eueka, here is a sample project, you should be able to use this along with the blog post above to build a working example: https://github.com/spring-cloud/spring-cloud-consul/tree/master/spring-cloud-consul-sample
I wrote a demo project using Spring Cloud Consul and Spring Cloud Netflix.
I'm using Consul as a service registry, and Ribbon/Hystrix/Feign are used to simplify API service clients.
The project is hosted on GitHub: https://github.com/alexandreroman/number2words.

Resources