August 2018
Intermediate to advanced
372 pages
9h 29m
English
Since Reactor can be used with Spring Data, we can take full advantage of the reactive programming model at this stage. This means that you can persist data represented as Flux or Mono objects. Let's review the following example, implemented with MongoDB:
@Testpublic void findAllShouldFindTheTotalAmountOfRecordsInserted() { int quantityOfEntitiesToPersistAsFlux = 100; // Saving a Flux with 100 items repository.saveAll ( Flux.just(generateArrayWithElements (quantityOfEntitiesToPersistAsFlux)) ) .then() .block(); // Saving a Mono repository.saveAll(Mono.just(new Customer("Rene"))) .then() .block(); List<String> customerIds = repository.findAll() .map(customer -> customer.getId()) .collectList() .block(); int totalAmountOfInserts ...Read now
Unlock full access