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
Tag: spring-webflux
Strange error with WebFlux and Spring-Integration – IndexOutOfBoundsException exceeds maxCapacity
I am in the process of writing a spring-integration flow that is intended to enrich the headers of a message based on the determination if a remote resource actually exists. Assuming that there is a RESTful endpoint that has an API on it that will locate an object based on a unique name: /mix-entity/name/{mixEntityName}. This API will return a JSON
Spring WebFlux: Merge Mono and Flux / Put Mono into Flux?
I’m wondering if it is possible to put the value of a Mono as a value into a Flux just like you could append any object to a list. I know there are some methods you could use but none of them fulfills my exact purpose. What I tried so far: This doesn’t sound too bad but notice that it
Asynchronous inserts to cassandra with save order of inserts per key
I have an ordered set of incoming events and I need to insert them into Cassandra. I want to take advantage of the speed of asynchronous inserts, but my incoming events may have duplicates by key of target table. If I understand correctly, then asynchronous insertions can’t guarantee data consistency in this case, since asynchronous executions imply the program order
How right to send Flux or Mono to template (Freemaker)
I got from my repository Flux and in my controller I want to send it to my template. my controller: I getting error in my Freemarker’s template : reemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> user Answer Question is, what do you need to call in Java to get the content of the user? When you write
In the Response, i am getting scanAvailable=true when returning flux as ResponseEntity
I am slightly confused to get the proper response when the user tries to use two rest endpoints with WebClient. I want to use it as asynchronous and non-blocking in the code. I am returning the Flux from the controller. The code details are as below: The Controller Class method looks like this: It is calling getGitRepos method. The method
How to convert a Flux<List> to a merged Flux?
While working with Project Reactor, there came a use case where I’d want to convert a Flux <List<String>> to a <Flux<String>> where all those lists are flattened to form a Flux. Is there any out of the box method for the same? Answer Use .flatMap(Flux::fromIterable)
Update objects’s state in Reactor
Given the following method: switchIfEmpty and map operators mutate the profileUpdate object. Is it safe to mutate in switchIfEmpty operator? Regarding map, if I have understood correctly, this is not safe and object profileUpdate must be immutable, right? eg: Later in the chain, another method mutates the object: The above methods are called as follows: Answer Nebulous answer, but… it
Getting a list of JSON Users objs. in a POST request and return a response also as JSON
This is my first time using spring-webflux with SpringBoot. My goal is to create an API that accepts a list of Users in JSON format in the body of a POST and return a response with that list also in JSON format ordered by a date field. The ordering is not a problem but I do not know very well
How to save the request body after reading it in the ServerAuthenticationConverter?
Guys! maybe someone faced the problem of getting the request body.. I am trying to friend Spring WebFlux + Security: I use SecurityConfig where I set for check authentication I have a custom Converter (AuthDataConverter) and a custom Manager (AuthManager). When I do POST http Request I am falling in Converter: inside of the Converter – I get Headers and