1 回答
TA贡献1890条经验 获得超9个赞
onErrorResume为我解决上述问题。
bookResponseMono = webClient.get()
.uri("/getBooking/" + bookingId)
.headers(headers->headers.addAll(args))
.retrieve()
.bodyToMono(String.class)
.onErrorResume(err -> {
BookResponse bookResponse = new BookResponse();
bookResponse.setError(setError(err));
return Mono.just(setError(err));
});
addressResponseMono = webClient.get()
.uri("/getAddress/" + bookingId)
.headers(headers -> headers.addAll(args))
.retrieve()
.bodyToMono(String.class)
.onErrorResume(err -> {
Address address = new Address();
address.setError(setError(err));
return Mono.just(setError(err));
});
最后拉上拉链
bookAndAddressResponse = bookResponseMono
.zipWith(addressResponseMono, BookAndAddressResponse::new)
.block();
添加回答
举报