Spring Cloud OpenFeign vs WebClient - spring-cloud

For Spring Boot based microservices communicating with each other via load-balanced clients (with Spring Cloud LoadBalancer) which client should be used, WebClient or OpenFeign?
From what I’ve read they both support Spring Cloud LoadBalancer. I know that WebClient also supports reactive, but that is not a feature we need.
Are both clients going to continue to be supported by Spring for the foreseeable future?
From what I can see Spring seems to be pushing WebClient. However, I still see development activity going on in the spring-cloud-openfeign github repo.
OpenFeign seems to be an easier/cleaner to use way of creating the clients, but are there any drawbacks compared to WebClient?

Related

Can one setup Spring Boot 2.6 and Spring Cloud 2021.x to use Ribbon and Hystrix with Spring WebClient and Feign?

I know that Spring Cloud at some version (3.0?) dropped direct support for some Netflix libraries like Ribbon or Hystrix. Now I'm trying to make a smooth migration of around 20 microservices running on production having some custom code extending Ribbon (and Hystrix to a lesser degree). The main goal is to upgrade from Spring Boot 2.3 to 2.6. As a consequence I need to upgrade Spring Cloud to 3.1.x, right?
My guess was to proceed with 2-step upgrade to avoid a one big-step migration:
Upgrade to Spring Boot 2.6 and Spring Cloud 3.1 while still using Ribbon and Hystrix
Make a way through a jungle of an old code and getting rid of Ribbon and Hystrix in smaller increments.
However to achieve this I'm trying to use simultanously Spring Boot 2.6, Spring Cloud with release train 2021.01 and 2 selected starters from older Spring Cloud (latest versions of these artifacts):
spring-cloud-starter-netflix-hystrix 2.2.10.RELEASE
spring-cloud-starter-netflix-ribbon 2.2.10.RELEASE
Is this possible at all? We are heavilly using Feign and Spring WebClient - client-side load-balancing must work for these. So far I found out Feign clients are not automatically integrated with Ribbon.
#spencergibb #OlgaMaciaszek - especially counting on you.
Answering my own question after receiving confirmation from Spring Cloud team by other means: this is a bad idea to try use Ribbon with Spring Cloud 2021.01 and it would require a really hard work to make it working.
So short answer is: "no".

Spring Cloud Kubernetes vs. Kubernetes API Client

I want to run a restapi server, a spring boot app, to kick start other docker containers inside of the same kubernetes cluster. I found these 2 packages:Spring Cloud Kubernetes and Kubernetes API Client. I am confused on what the difference between the two and which one should I use.
With Spring cloud cal version (2020.x.x), spring cloud Kubernetes comes with two implementations - Fabric8 and Kubernetes Java Client. See here.
NOTE - Prior to spring-cloud cal version spring-cloud-kubernetes used fabric8 impl
Both implementations works fine. While there are many, here is one of the blog comparing the two. In general Fabric8 seems to have more features.
I am not sure if the Spring community prefers any particular impl. Both projects are active.
Spring example here.
I too have an example using Frabric8 on github.

What happened to Spring Cloud RSocket

I have a question to the Spring Cloud guys.
Approx. a year ago, there were nice presentations about Spring Cloud RSocket.
Part of it included RSocket Support in Spring Cloud Gateway, aka. the rsocket-broker.
Now I see that https://github.com/spring-cloud-incubator/spring-cloud-rsocket has been archived.
I am wondering: does this mean Spring Cloud RSocket is dead? Is there any replacement? Is there any other support for RSocket in Spring Cloud Gateway? Or is Spring Cloud RSocket simply dormant and there is hope for it to be resurrected?
P.S.: I am aware of RSocket support in Spring Boot which is very nicely described here. What I am interested in, is the Spring Cloud RSocket features that I did not find the Spring Boot RSocket support.
Quoting from the description of that project
This repository is now inactive. Please see https://github.com/rsocket-broker

Like Spring boot, can I switch to a different http server in vertx?

https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-web-servers.html
Spring boot allows changing the web server, other than the embedded Tomcat server. Does Vertx provide similar capability?
Vert.x is implemented over netty (A lightweight event-driven network application framework).
Under the hood, starting a Vert.x HttpServer bootstraps a Netty server by default: meaning you cannot switch to another implementation.
While it should be possible to use Vertx with any web server, Vertx comes with a HttpServer in the Vert.x-Web package that can deliver static files and has routing options, role and security features and many more.
All of these are optional, yet pretty easy to use/implement if you follow the documentation. Also see all the other available modules.
If you use the Vertx webserver module you don't need a container like Tomcat, you can deploy a fat-jar and start that like any java application.
You could as well use nginx as a reverse proxy in front of vertx. This setup gives you more flexibility and you can use the full power of nginx for serving static files, your ssl configuration, gziping etc.

Spring Cloud components confusion

How do these Spring components relate/differ to/from each other? What does each represent conceptually? Would one use them together or are they competing projects?
Spring Cloud Data Flow
Spring Cloud Stream
Spring Cloud Task
Spring Cloud Task App Starters
Spring Batch
From my understanding, SC Tasks are just "units of work" to execute, a processing unit in the form of a short-lived/task-based microservice. SC Data Flow is orchestration for the tasks. These two I (think I) understand how they relate and what they represent conceptually, but a lot of documentation and examples talk about the other projects in the same context.
I also thought that SC Task was a replacement for Spring Batch but in some examples they seem to imply that Spring Batches are executed inside SC Tasks
Thanks for your interest in Spring Cloud projects! Find below the high-level introductions for the primary projects involved in Spring Cloud Data Flow (SCDF) ecosystem. The launch blog covers the backstory and among other details.
Spring Cloud Stream is a lightweight event-driven microservices framework to quickly build applications that can connect to external systems (eg: Kafka, Cassandra, MySQL, Hadoop, ..).
Spring Cloud Task is a short-lived microservices framework to quickly build applications that perform finite amounts of data processing (eg: batch-jobs, ..). The connection with Spring Batch framework is explained in the launch blog linked above.
Spring Cloud Data Flow provides the orchestration mechanics to deploy applications built with Spring Cloud Stream and Spring Cloud Task programming model to a variety of runtime platforms including Cloud Foundry, Apache Yarn, Apache Mesos and Kubernetes. There's community developed SCDF implementations for OpenShift and Nomad, too. More details here.
The building blocks visual from the project site should cover the high-level interaction between the various projects in SCDF's ecosystem.