Мне нужно написать метод, который выполняет
- Получает
Location
заголовок из конечной точки - Создает серию
Some
, каждый из которых должен извлекаться из Location
получено с первой конечной точки. - Необходимо вернуть
Flux<Some>
Что выглядит так.
private WebClient client;
Flux<Some> getSome() {
// Get the Location header from an endpoint
client
.post()
.exchange()
.map(r -> r.headers().header("Location"))
// Now I need to keep invoking the Location endpoint for Some.class
// And Some.class has an attribute for pending/completion status.
// e.g.
while (true)
final Some some = client
.get()
.url(...) // the Location header value above
.retrieve()
.bodyToMono(Some.class)
.block()
;
}
}
Как я могу сопоставить Mono<String>
до Flux<Some>
при использовании атрибута Some#status
для завершения?
// should return Flux<Some>
client
.post()
.exchange()
.map(r -> r.headers().header("Location"))
.flatMapMany(location -> {
// invokes location while retrieved Some#status is not `completed`
// @@?
})
;