Код: Выделить всё
public class Item(){
public Item(String id, Map bunchOfThings){
this.id = id;
this.things = bunchOfThings;
externalService.methodThatReturnsMono(id)
.subscribe(attribute -> this.attribute = Optional.of(attribute));
}
Optional attribute = Optional.empty();
}
Код: Выделить всё
public String getAttribute() {
if(attribute.isPresent())
return attribute.get();
else
//I want to wait until the attribute is obtained, like get hooked again in the reactive flow and wait till is done, not resubscribe and trigger again the "methodThatReturnsMono"
}