I created a Spring Boot 2.0 demo application that contains two applications that communicate using WebClient. And I suffer from the fact that they often stop communicating when I use the Block () Flux method from the WebClient response. I want to use List not Flux for some reason.
The server-side application is as follows. It just returns a Flux object.
@GetMapping
public Flux<Item> findAll() {
return Flux.fromIterable(items);
}
And the client side application (or BFF) looks like this. I get Flux from the server and convert it to List by calling the block () method.
@GetMapping
public List<Item> findBlock() {
return webClient.get()
.retrieve()
.bodyToFlux(Item.class)
.collectList()
.block(Duration.ofSeconds(10L));
}
, findBlock() . findBlock(), Flux, collectList() block(), . , block() .
, findAll(), List, .
.
https://github.com/cero-t/webclient-example
"" - , "front" - . , localhost: 8080, , , localhost: 8080/block, , , .
, "spring -boot-starter-web" "" ( ) pom.xml, , tomcat, . Netty?
.