我怎样才能让 Mono Void 在另一个 Mono Void 中返回?
How can I make Mono Void get returned in another Mono Void?
Mono<Void> my_function(final String reviewObject){
return Mono.fromCallable(
() -> {
ReviewDto reviewDto = new ReviewDto();
try {
objectMapper.updateValue(reviewDto, reviewObject);
} catch (JsonMappingException e) {
throw new InvalidPayloadException("Invalid payload");
}
return reviewDto;
}).then();
}
当我调用 my_function 时它没有调用(工作),我该怎么办??
Mono<Void> another_function(){
my_function(reviewObject);
}
Mono<Void> another_function(){
return my_function(reviewObject);
}
并让您 another_function()
的消费者决定如何处理返回的 Mono<Void>
!
准确地说,它当然是 subscribe()
这种或其他反应方式 Publisher
:https://projectreactor.io/docs/core/release/reference/#_subscribe_method_examples
Mono<Void> my_function(final String reviewObject){
return Mono.fromCallable(
() -> {
ReviewDto reviewDto = new ReviewDto();
try {
objectMapper.updateValue(reviewDto, reviewObject);
} catch (JsonMappingException e) {
throw new InvalidPayloadException("Invalid payload");
}
return reviewDto;
}).then();
}
当我调用 my_function 时它没有调用(工作),我该怎么办??
Mono<Void> another_function(){
my_function(reviewObject);
}
Mono<Void> another_function(){
return my_function(reviewObject);
}
并让您 another_function()
的消费者决定如何处理返回的 Mono<Void>
!
准确地说,它当然是 subscribe()
这种或其他反应方式 Publisher
:https://projectreactor.io/docs/core/release/reference/#_subscribe_method_examples