Merge pull request #7965 from macieg/bael-3285-3
BAEL-3285 | Removed block() calls
This commit is contained in:
commit
8a973cf690
|
@ -41,28 +41,25 @@ public class Client {
|
||||||
.bodyToMono(User.class);
|
.bodyToMono(User.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<User> fetchUsers(List<Integer> userIds) {
|
public Flux<User> fetchUsers(List<Integer> userIds) {
|
||||||
return Flux.fromIterable(userIds)
|
return Flux.fromIterable(userIds)
|
||||||
.parallel()
|
.parallel()
|
||||||
.runOn(Schedulers.elastic())
|
.runOn(Schedulers.elastic())
|
||||||
.flatMap(this::getUser)
|
.flatMap(this::getUser)
|
||||||
.collectSortedList((u1, u2) -> u2.id() - u1.id())
|
.ordered((u1, u2) -> u2.id() - u1.id());
|
||||||
.block();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<User> fetchUserAndOtherUser(int id) {
|
public Flux<User> fetchUserAndOtherUser(int id) {
|
||||||
return Flux.merge(getUser(id), getOtherUser(id))
|
return Flux.merge(getUser(id), getOtherUser(id))
|
||||||
.parallel()
|
.parallel()
|
||||||
.runOn(Schedulers.elastic())
|
.runOn(Schedulers.elastic())
|
||||||
.collectSortedList((u1, u2) -> u2.id() - u1.id())
|
.ordered((u1, u2) -> u2.id() - u1.id());
|
||||||
.block();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserWithItem fetchUserAndItem(int userId, int itemId) {
|
public Mono<UserWithItem> fetchUserAndItem(int userId, int itemId) {
|
||||||
Mono<User> user = getUser(userId).subscribeOn(Schedulers.elastic());
|
Mono<User> user = getUser(userId).subscribeOn(Schedulers.elastic());
|
||||||
Mono<Item> item = getItem(itemId).subscribeOn(Schedulers.elastic());
|
Mono<Item> item = getItem(itemId).subscribeOn(Schedulers.elastic());
|
||||||
|
|
||||||
return Mono.zip(user, item, UserWithItem::new)
|
return Mono.zip(user, item, UserWithItem::new);
|
||||||
.block();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,9 @@ public class ClientIntegrationTest {
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
List<User> users = client.fetchUsers(userIds);
|
List<User> users = client.fetchUsers(userIds)
|
||||||
|
.collectList()
|
||||||
|
.block();
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
Loading…
Reference in New Issue