diff --git a/spring-5-reactive-client/src/main/java/com/baeldung/reactive/webclient/simultaneous/Client.java b/spring-5-reactive-client/src/main/java/com/baeldung/reactive/webclient/simultaneous/Client.java index bbfc88322b..a72957d079 100644 --- a/spring-5-reactive-client/src/main/java/com/baeldung/reactive/webclient/simultaneous/Client.java +++ b/spring-5-reactive-client/src/main/java/com/baeldung/reactive/webclient/simultaneous/Client.java @@ -1,9 +1,8 @@ package com.baeldung.reactive.webclient.simultaneous; import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; -import reactor.core.scheduler.Schedulers; +import reactor.core.publisher.Mono; import java.util.List; import java.util.logging.Logger; @@ -19,8 +18,6 @@ public class Client { } public Mono getUser(int id) { - LOG.info(String.format("Calling getUser(%d)", id)); - return webClient.get() .uri("/user/{id}", id) .retrieve() @@ -43,22 +40,16 @@ public class Client { public Flux fetchUsers(List userIds) { return Flux.fromIterable(userIds) - .parallel() - .runOn(Schedulers.elastic()) - .flatMap(this::getUser) - .ordered((u1, u2) -> u2.id() - u1.id()); + .flatMap(this::getUser); } public Flux fetchUserAndOtherUser(int id) { - return Flux.merge(getUser(id), getOtherUser(id)) - .parallel() - .runOn(Schedulers.elastic()) - .ordered((u1, u2) -> u2.id() - u1.id()); + return Flux.merge(getUser(id), getOtherUser(id)); } public Mono fetchUserAndItem(int userId, int itemId) { - Mono user = getUser(userId).subscribeOn(Schedulers.elastic()); - Mono item = getItem(itemId).subscribeOn(Schedulers.elastic()); + Mono user = getUser(userId); + Mono item = getItem(itemId); return Mono.zip(user, item, UserWithItem::new); }