2
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();
}

when I call my_function it is not invoking (working), what should I do ??

Mono<Void> another_function(){
   my_function(reviewObject);
}
akarnokd
  • 69,132
  • 14
  • 157
  • 192
Abdulmalik
  • 33
  • 1
  • 2
  • 6
  • 2
    `nothing happens until you subscribe` https://projectreactor.io/docs/core/release/reference/#_subscribe_method_examples – Toerktumlare Feb 15 '21 at 13:31
  • According to @Toerktumlare you should invoke your method inside of another_function method so: `my_function(reviewObject).suscribe();` – Cesar Miguel Feb 17 '21 at 09:09

1 Answers1

1
Mono<Void> another_function(){
   return my_function(reviewObject);
}

and let a consumer of your another_function() to decide what to do with that returned Mono<Void>!

To be precise it is of course a subscribe() this or other way to that reactive Publisher: https://projectreactor.io/docs/core/release/reference/#_subscribe_method_examples

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118