I am using ParallelFlux for running many task.
but when i am receiving webClient response using bodyToFlux method its merging all the output response instead of getting one by one.
i want the output should be one by one not single string, is there any other method instead of bodyToFLux need to use.
request method:
Flux<String> responsePost = webClient.build() //removed get,url and retrieve here .bodyToFlux(String.class); responsePost.subscribe(s -> { //display response });
response method:
public ParallelFlux<String> convertListToMap() { //created list of string str return Flux.fromIterable(str) .parallel(3) .runOn(Schedulers.parallel()) .map( s -> { //some logic here }); }
output:
parallel fulx reponse: springwebfluxparellelExample
webClient response using bodyToFlux method merging all the received response instead separating it out
3.7k Views Asked by Shekhar Rathore At
1
Here instead of returning ParallelFlux create an ResponseBody class with variable you want to return, assign your response to variable inside ResponseBody and return it to caller of API function.