I am working on several spring-boot applications which have the traditional pattern of thread-per-request. We are using Spring-boot-webflux to acquire WebClient to perform our RESTful integration between the applications. Hence our application design requires that we block the publisher right after receiving a response. Recently, we’ve been discussing whether we are unnecessarily spending resources using a reactive module in our
Tag: spring-webclient
spring-webflux : How to Extract user defined object from Mono or Flux from the response without blocking?
getUserDetails Method returns Mono of Type JsonNode. But I Actually want to return a Mono<User.java> or Flux<User.java>. please help modifying getBulkUserInfo or getUserDetails to get the Mono<User.java> or Flux<User.java> But The json response from the Url is something like I tried different ways but nothing worked subscribe() and .doOnNext(resp -> resp.get(“resultholder”).get(“profiles”).get(“profileholder”).get(“user”)) Answer This is pretty straightforward and there is no
Spring WebClient corrupts binary data
I’m sending files containing binary data from service A to service B. When the number of files is relatively small (let’s say 5) everything works well. However, when I try to send more files (let’s say several hundred) it sometimes fails. I tried to check what is happening with this binary data, and it looks like WebClient corrupts it in
Webclient sending request body with get request
I have a spring-boot project called carrental-crud with an h2 memory database, and I want to access one of the endpoints from another project called carrental-api. I use webClientBuilder for this on my other endpoints, but it is throwing status 500 with bad request when I try using it in postman. I use JPArepository to access the h2 db with
Flux – parallel flatMap with webclient – limit to fixed batched rate
The code I have is this: It just requests HEAD, until first 6 requests are successful. Parallelization works here, but the problem is that after 1 of the requests is complete, it immediatley triggers next request (to maintain parallelization level of 6). What I need here is to have parallelization level of 6, but in batches. So – trigger 6
Spring WebClient Retry Logic with new Headers
I am trying to build a retry logic using Spring WebClient. The problem that I am trying to solve is very simple. I am calling an API endpoint to get some values. If the API returns an error with say 401 response, then I will have to make call to Token service and renew my token and use the new
Disable Spring Boot Webclient logs
I want to build a simple Spring Web Client who send message from stdin but the WebClient show all debug informations on stdout. How to disable the logs generated by Webclient ? Code of the client Answer you can customize your logs as you want. as the image you mention, Go to the application.properties put logger values to disable as
How to avoid hardcode in every class WebClient retryWhen
I want to implement retry mechanism and I did something like this: And used this method here: But I want to create a generic one to use it across all application to not write first method in all classes, how can I do this more efficiently? Answer The way that I decided to implement this is as follows: And called
Merge two api responses into one using Webclient – Webflux
I’m using WebFlux and WebClient and I need to consume two APIs and merge its responses. The first API receive type and document number and returns a list with one element that contains customer data (that’s how it’s defined). The second API receive a client id and returns a customer payments list. I need to consume these two APIs and