How to save in fire and forget mode with spring 5 reactive repository

Viewed 2668

I'm trying to figure how to make a save in (for example mongo) with a spring 5 ReactiveCrudRepository in fire and forget mode.

The code is simple

public Mono<MyObject> saveObject(Mono<MyObject> mono) {
    return mono.flatMap(objectRepository::save);
}

the fact is i don't need to read the returned Value, and in the reactive world, reading action trigger the save.

i have tried objectService.saveObject(Mono.just(object)).block(); and it works just fine, but it's blocking :D

I wonder how to do it properly. (or if it is simply a bad idea)

thanks Julien

1 Answers
Related